Package com.nimbusds.oauth2.sdk
Class TokenRevocationRequest
java.lang.Object
com.nimbusds.oauth2.sdk.AbstractRequest
com.nimbusds.oauth2.sdk.AbstractOptionallyAuthenticatedRequest
com.nimbusds.oauth2.sdk.AbstractOptionallyIdentifiedRequest
com.nimbusds.oauth2.sdk.TokenRevocationRequest
Token revocation request. Used to revoke an issued access or refresh token.
Example token revocation request for a confidential client:
POST /revoke HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW token=45ghiukldjahdnhzdauz&token_type_hint=refresh_token
Example token revocation request for a public client:
POST /revoke HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded token=45ghiukldjahdnhzdauz&token_type_hint=refresh_token&client_id=123456
Related specifications:
- OAuth 2.0 Token Revocation (RFC 7009), section 2.1.
-
Constructor Summary
ConstructorsConstructorDescriptionTokenRevocationRequest(URI uri, ClientAuthentication clientAuth, Token token) Creates a new token revocation request for a confidential client.TokenRevocationRequest(URI uri, ClientID clientID, Token token) Creates a new token revocation request for a public client. -
Method Summary
Modifier and TypeMethodDescriptiongetToken()Returns the token to revoke.static TokenRevocationRequestparse(HTTPRequest httpRequest) Parses a token revocation request from the specified HTTP request.Returns the matching HTTP request.Methods inherited from class com.nimbusds.oauth2.sdk.AbstractOptionallyIdentifiedRequest
getClientIDMethods inherited from class com.nimbusds.oauth2.sdk.AbstractOptionallyAuthenticatedRequest
getClientAuthenticationMethods inherited from class com.nimbusds.oauth2.sdk.AbstractRequest
getEndpointURI
-
Constructor Details
-
TokenRevocationRequest
Creates a new token revocation request for a confidential client.- Parameters:
uri- The URI of the token revocation endpoint. May benullif thetoHTTPRequest()method will not be used.clientAuth- The client authentication. Must not benull.token- The access or refresh token to revoke. Must not benull.
-
TokenRevocationRequest
Creates a new token revocation request for a public client.- Parameters:
uri- The URI of the token revocation endpoint. May benullif thetoHTTPRequest()method will not be used.clientID- The client ID. Must not benull.token- The access or refresh token to revoke. Must not benull.
-
-
Method Details
-
getToken
Returns the token to revoke. 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.
-
toHTTPRequest
Description copied from interface:RequestReturns the matching HTTP request.- Returns:
- The HTTP request.
-
parse
Parses a token revocation request from the specified HTTP request.- Parameters:
httpRequest- The HTTP request. Must not benull.- Returns:
- The token revocation request.
- Throws:
ParseException- If the HTTP request couldn't be parsed to a token revocation request.
-