Package com.nimbusds.oauth2.sdk
Class TokenIntrospectionRequest
java.lang.Object
com.nimbusds.oauth2.sdk.AbstractRequest
com.nimbusds.oauth2.sdk.AbstractOptionallyAuthenticatedRequest
com.nimbusds.oauth2.sdk.TokenIntrospectionRequest
Token introspection request. Used by a protected resource to obtain the
authorisation for a submitted access token. May also be used by clients to
query a refresh token.
The protected resource may be required to authenticate itself to the
token introspection endpoint with a standard client
authentication method, such as
client_secret_basic,
or with a dedicated access token.
Example token introspection request, where the protected resource authenticates itself with a secret (the token type is also hinted):
POST /introspect HTTP/1.1 Host: server.example.com Accept: application/json Content-Type: application/x-www-form-urlencoded Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW token=mF_9.B5f-4.1JqM&token_type_hint=access_token
Example token introspection request, where the protected resource authenticates itself with a bearer token:
POST /introspect HTTP/1.1 Host: server.example.com Accept: application/json Content-Type: application/x-www-form-urlencoded Authorization: Bearer 23410913-abewfq.123483 token=2YotnFZFEjr1zCsicMWpAA
Related specifications:
- OAuth 2.0 Token Introspection (RFC 7662).
-
Constructor Summary
ConstructorsConstructorDescriptionTokenIntrospectionRequest(URI uri, ClientAuthentication clientAuth, Token token) Creates a new token introspection request.TokenIntrospectionRequest(URI uri, ClientAuthentication clientAuth, Token token, Map<String, List<String>> customParams) Creates a new token introspection request.TokenIntrospectionRequest(URI uri, AccessToken clientAuthz, Token token) Creates a new token introspection request.TokenIntrospectionRequest(URI uri, AccessToken clientAuthz, Token token, Map<String, List<String>> customParams) Creates a new token introspection request.TokenIntrospectionRequest(URI uri, Token token) Creates a new token introspection request.Creates a new token introspection request. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client authorisation.Returns the custom request parameters.getToken()Returns the token to introspect.static TokenIntrospectionRequestparse(HTTPRequest httpRequest) Parses a token introspection request from the specified HTTP request.Returns the matching HTTP request.Methods inherited from class com.nimbusds.oauth2.sdk.AbstractOptionallyAuthenticatedRequest
getClientAuthenticationMethods inherited from class com.nimbusds.oauth2.sdk.AbstractRequest
getEndpointURI
-
Constructor Details
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter is not authenticated.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.token- The access or refresh token to introspect. Must not benull.
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter is not authenticated.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.token- The access or refresh token to introspect. Must not benull.customParams- Optional custom parameters,nullif none.
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter may authenticate with a secret or private key JWT assertion.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.clientAuth- The client authentication,nullif none.token- The access or refresh token to introspect. Must not benull.
-
TokenIntrospectionRequest
public TokenIntrospectionRequest(URI uri, ClientAuthentication clientAuth, Token token, Map<String, List<String>> customParams) Creates a new token introspection request. The request submitter may authenticate with a secret or private key JWT assertion.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.clientAuth- The client authentication,nullif none.token- The access or refresh token to introspect. Must not benull.customParams- Optional custom parameters,nullif none.
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter may authorise itself with an access token.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.clientAuthz- The client authorisation,nullif none.token- The access or refresh token to introspect. Must not benull.
-
TokenIntrospectionRequest
public TokenIntrospectionRequest(URI uri, AccessToken clientAuthz, Token token, Map<String, List<String>> customParams) Creates a new token introspection request. The request submitter may authorise itself with an access token.- Parameters:
uri- The URI of the token introspection endpoint. May benullif thetoHTTPRequest()method will not be used.clientAuthz- The client authorisation,nullif none.token- The access or refresh token to introspect. Must not benull.customParams- Optional custom parameters,nullif none.
-
-
Method Details
-
getClientAuthorization
Returns the client authorisation.- Returns:
- The client authorisation as an access token,
nullif none.
-
getToken
Returns the token to introspect. Theinstanceofoperator can be used to infer the token type. If it's neitherAccessTokennorRefreshTokenthetoken_type_hinthas not been provided as part of the token revocation request.- Returns:
- The token.
-
getCustomParameters
Returns the custom request parameters.- Returns:
- The custom request parameters, empty map if none.
-
toHTTPRequest
Description copied from interface:RequestReturns the matching HTTP request.- Returns:
- The HTTP request.
-
parse
Parses a token introspection request from the specified HTTP request.- Parameters:
httpRequest- The HTTP request. Must not benull.- Returns:
- The token introspection request.
- Throws:
ParseException- If the HTTP request couldn't be parsed to a token introspection request.
-