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 endpoint, ClientAuthentication clientAuth, Token token) Creates a new token introspection request.TokenIntrospectionRequest
(URI endpoint, ClientAuthentication clientAuth, Token token, Map<String, List<String>> customParams) Creates a new token introspection request.TokenIntrospectionRequest
(URI endpoint, AccessToken clientAuthz, Token token) Creates a new token introspection request.TokenIntrospectionRequest
(URI endpoint, AccessToken clientAuthz, Token token, Map<String, List<String>> customParams) Creates a new token introspection request.TokenIntrospectionRequest
(URI endpoint, 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 TokenIntrospectionRequest
parse
(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
getClientAuthentication
Methods 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:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to 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:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to be used.token
- The access or refresh token to introspect. Must not benull
.customParams
- Optional custom parameters,null
if none.
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter may authenticate with a secret or private key JWT assertion.- Parameters:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to be used.clientAuth
- The client authentication,null
if none.token
- The access or refresh token to introspect. Must not benull
.
-
TokenIntrospectionRequest
public TokenIntrospectionRequest(URI endpoint, 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:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to be used.clientAuth
- The client authentication,null
if none.token
- The access or refresh token to introspect. Must not benull
.customParams
- Optional custom parameters,null
if none.
-
TokenIntrospectionRequest
Creates a new token introspection request. The request submitter may authorise itself with an access token.- Parameters:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to be used.clientAuthz
- The client authorisation,null
if none.token
- The access or refresh token to introspect. Must not benull
.
-
TokenIntrospectionRequest
public TokenIntrospectionRequest(URI endpoint, 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:
endpoint
- The URI of the token introspection endpoint. May benull
if thetoHTTPRequest()
method is not going to be used.clientAuthz
- The client authorisation,null
if none.token
- The access or refresh token to introspect. Must not benull
.customParams
- Optional custom parameters,null
if none.
-
-
Method Details
-
getClientAuthorization
Returns the client authorisation.- Returns:
- The client authorisation as an access token,
null
if none.
-
getToken
Returns the token to introspect. Theinstanceof
operator can be used to infer the token type. If it's neitherAccessToken
norRefreshToken
thetoken_type_hint
has 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:Request
Returns 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.
-