Invoke the OAuth Introspection Endpoint¶
The OAuth Introspection endpoint is as follows:
https://localhost:9443/oauth2/introspect
OAuth 2.0 Token Introspection defines a protocol that allows authorized
protected resources to query the authorization server to determine the
set of metadata for a given token that was presented to them by an OAuth
Client. This metadata includes whether the token is currently active
(or if it has expired or otherwise been revoked ), what rights
of access the token carries (usually conveyed through OAuth 2.0 scopes),
and the authorization context in which the token was granted (including
who authorized the token and which client it was issued to). Token
introspection allows a protected resource to query this information
regardless of whether it is carried in the token itself, allowing this
method to be used along with or independently of structured token
values.
The states and descriptions of authorization codes and access tokens are as follows.
-
Authorization codes:
ACTIVE
- Valid and yet to be exchanged for an access token.INACTIVE
- Invalid and already being exchanged for an access token.EXPIRED
- Invalid as it got expired before being exchanged to an access token.
-
Access tokens:
ACTIVE
- Valid access token. Although the state is ACTIVE, thetimestamp
calculation may reveal it to beEXPIRED
, but this happens only during the first access token request or token validation request after expiration.INACTIVE
- Refreshed usingrefresh_token
grant type before expiration. Also, this state is used in cases when users and user stores are deleted, user passwords are updated, etc.EXPIRED
- Invalid and expired access token. Refresh token can still be valid though.REVOKED
- Revoked access token. Refresh token also gets revoked along with access token. Access token could have been inACTIVE
orEXPIRED
state while revoking.
Invoking the endpoint for the super tenant¶
Use the following cURL commands given in the following sections to invoke the OAuth introspection endpoint for the super tenant users.
Note
- For requests that require
CLIENT_ID:CLIENT_SECRET
, use the client ID and client secret of the OAuth service provider. For more information on creating an OAuth service provider, see Configuring Inbound Authentication for a Service Provider. -
For requests that require
USERNAME:PASSWORD
, by default you can use credentials of any user with "/permission/admin/manage/identity/applicationmgt/view" permissions. To allow users with other permissions to send validation requests, the permissions can be added to the<IS_HOME>/repository/conf/deployment.toml
` file.[resource_access_control.introspect] permissions = ["/permission/admin/manage/identity/applicationmgt/view","/permission/admin/login"]
-
Token introspection across tenant domains is enabled by default. To disable cross tenant token validation, add the following configuration to the
<IS_HOME>/repository/conf/deployment.toml
file and restart the server.[oauth.introspect] allow_cross_tenant = false
Get a valid token¶
Request | |
Response |
Validate the token¶
Request |
You can pass the token type as an optional parameter in the request (e.g., |
Response |
Get a valid token with a scope¶
Request | |
Response |
Validate the token¶
Request | |
Response |
Invalid token¶
If the token that you used is invalid, you get the following response:
{'active':false}
Empty token¶
If you leave the token parameter empty as shown below, you get the following response :
Request | |
Response |
Invoking the endpoint for tenants¶
Use the following cURL commands given in the following sections to invoke the OAuth introspection endpoint for tenant users.
Note
- For requests that require
CLIENT_ID:CLIENT_SECRET
, use the client ID and client secret of the OAuth service provider. For more information on creating an OAuth service provider, see Configuring Inbound Authentication for a Service Provider . - For requests that require
USERNAME@TENANT_DOMAIN:PASSWORD
, by default you can use credentials of any user with "/permission/admin/manage/identity/applicationmgt/view" permissions.
Get a valid token¶
Request | |
Response |
Validate the token¶
Request | You can use any of the request formats given below: Or
Request
You can pass the token type as an optional parameter in the request (e.g., |
Response |
Get a valid token with a scope¶
Request | |
Response |
Validate the token¶
Request | You can use any of the request formats given below: Or |
Response |
Invalid token¶
If the token that you used is invalid, you get the following response:
Response
{'active':false}
Empty token¶
If you leave the token parameter empty as shown below, you get the following response:
Request | Example: |
Response |
Tip
Above samples only explains validating a token obtained for Client credentials grant using the introspect endpoint. Similarly, you may invoke introspection endpoint with a token obtained from any other grant type as well.