Package com.nimbusds.oauth2.sdk
Class TokenIntrospectionSuccessResponse
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.TokenIntrospectionResponse
-
- com.nimbusds.oauth2.sdk.TokenIntrospectionSuccessResponse
-
- All Implemented Interfaces:
Message
,Response
,SuccessResponse
@Immutable public class TokenIntrospectionSuccessResponse extends TokenIntrospectionResponse implements SuccessResponse
Token introspection success response.Related specifications:
- OAuth 2.0 Token Introspection (RFC 7662).
- OAuth 2.0 Rich Authorization Requests (RFC 9396), section 9.2.
- OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens (RFC 8705).
- OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP) (RFC 9449)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TokenIntrospectionSuccessResponse.Builder
Builder for constructing token introspection success responses.
-
Constructor Summary
Constructors Constructor Description TokenIntrospectionSuccessResponse(net.minidev.json.JSONObject params)
Creates a new token introspection success response.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<Audience>
getAudience()
Returns the intended audience for the token.List<AuthorizationDetail>
getAuthorizationDetails()
Returns the Rich Authorisation Request (RAR) details.boolean
getBooleanParameter(String name)
Returns the boolean parameter with the specified name.ClientID
getClientID()
Returns the identifier of the OAuth 2.0 client that requested the token.Date
getExpirationTime()
Returns the token expiration time.Issuer
getIssuer()
Returns the token issuer.Date
getIssueTime()
Returns the token issue time.net.minidev.json.JSONArray
getJSONArrayParameter(String name)
Returns the JSON array parameter with the specified name.net.minidev.json.JSONObject
getJSONObjectParameter(String name)
Returns the JSON object parameter with the specified name.JWKThumbprintConfirmation
getJWKThumbprintConfirmation()
Returns the JSON Web Key (JWK) SHA-256 thumbprint confirmation, for OAuth 2.0 DPoP.JWTID
getJWTID()
Returns the token identifier.Date
getNotBeforeTime()
Returns the token not-before time.Number
getNumberParameter(String name)
Returns the number parameter with the specified name.net.minidev.json.JSONObject
getParameters()
Returns the underlying parameters.Scope
getScope()
Returns the scope of the token.List<String>
getStringListParameter(String name)
Returns the string list parameter with the specified name.String
getStringParameter(String name)
Returns the string parameter with the specified name.Subject
getSubject()
Returns the subject of the token, usually a machine-readable identifier of the resource owner who authorised the token.AccessTokenType
getTokenType()
Returns the access token type.String
getUsername()
Returns the username of the resource owner who authorised the token.X509CertificateConfirmation
getX509CertificateConfirmation()
Returns the client X.509 certificate confirmation, for a mutual TLS client certificate bound access token.com.nimbusds.jose.util.Base64URL
getX509CertificateSHA256Thumbprint()
Deprecated.boolean
indicatesSuccess()
Checks if the response indicates success.boolean
isActive()
Returns the active status for the token.static TokenIntrospectionSuccessResponse
parse(HTTPResponse httpResponse)
Parses a token introspection success response from the specified HTTP response.static TokenIntrospectionSuccessResponse
parse(net.minidev.json.JSONObject jsonObject)
Parses a token introspection success response from the specified JSON object.HTTPResponse
toHTTPResponse()
Returns the matching HTTP response.net.minidev.json.JSONObject
toJSONObject()
Returns a JSON object representation of this token introspection success response.-
Methods inherited from class com.nimbusds.oauth2.sdk.TokenIntrospectionResponse
toErrorResponse, toSuccessResponse
-
-
-
-
Constructor Detail
-
TokenIntrospectionSuccessResponse
public TokenIntrospectionSuccessResponse(net.minidev.json.JSONObject params)
Creates a new token introspection success response.- Parameters:
params
- The response parameters. Must contain at least the requiredactive
parameter and not benull
.
-
-
Method Detail
-
isActive
public boolean isActive()
Returns the active status for the token. Corresponds to theactive
parameter.- Returns:
true
if the token is active, elsefalse
.
-
getScope
public Scope getScope()
Returns the scope of the token. Corresponds to thescope
parameter.- Returns:
- The token scope,
null
if not specified.
-
getClientID
public ClientID getClientID()
Returns the identifier of the OAuth 2.0 client that requested the token. Corresponds to theclient_id
parameter.- Returns:
- The client identifier,
null
if not specified.
-
getUsername
public String getUsername()
Returns the username of the resource owner who authorised the token. Corresponds to theusername
parameter.- Returns:
- The username,
null
if not specified.
-
getTokenType
public AccessTokenType getTokenType()
Returns the access token type. Corresponds to thetoken_type
parameter.- Returns:
- The token type,
null
if not specified.
-
getExpirationTime
public Date getExpirationTime()
Returns the token expiration time. Corresponds to theexp
parameter.- Returns:
- The token expiration time,
null
if not specified.
-
getIssueTime
public Date getIssueTime()
Returns the token issue time. Corresponds to theiat
parameter.- Returns:
- The token issue time,
null
if not specified.
-
getNotBeforeTime
public Date getNotBeforeTime()
Returns the token not-before time. Corresponds to thenbf
parameter.- Returns:
- The token not-before time,
null
if not specified.
-
getSubject
public Subject getSubject()
Returns the subject of the token, usually a machine-readable identifier of the resource owner who authorised the token. Corresponds to thesub
parameter.- Returns:
- The token subject,
null
if not specified.
-
getAudience
public List<Audience> getAudience()
Returns the intended audience for the token. Corresponds to theaud
parameter.- Returns:
- The token audience,
null
if not specified.
-
getIssuer
public Issuer getIssuer()
Returns the token issuer. Corresponds to theiss
parameter.- Returns:
- The token issuer,
null
if not specified.
-
getJWTID
public JWTID getJWTID()
Returns the token identifier. Corresponds to thejti
parameter.- Returns:
- The token identifier,
null
if not specified.
-
getX509CertificateSHA256Thumbprint
@Deprecated public com.nimbusds.jose.util.Base64URL getX509CertificateSHA256Thumbprint()
Deprecated.Returns the client X.509 certificate SHA-256 thumbprint, for a mutual TLS client certificate bound access token. Corresponds to thecnf.x5t#S256
parameter.- Returns:
- The client X.509 certificate SHA-256 thumbprint,
null
if not specified.
-
getX509CertificateConfirmation
public X509CertificateConfirmation getX509CertificateConfirmation()
Returns the client X.509 certificate confirmation, for a mutual TLS client certificate bound access token. Corresponds to thecnf.x5t#S256
parameter.- Returns:
- The client X.509 certificate confirmation,
null
if not specified.
-
getJWKThumbprintConfirmation
public JWKThumbprintConfirmation getJWKThumbprintConfirmation()
Returns the JSON Web Key (JWK) SHA-256 thumbprint confirmation, for OAuth 2.0 DPoP. Corresponds to thecnf.jkt
parameter.- Returns:
- The JWK SHA-256 thumbprint confirmation,
null
if not specified.
-
getAuthorizationDetails
public List<AuthorizationDetail> getAuthorizationDetails()
Returns the Rich Authorisation Request (RAR) details. Corresponds to theauthorization_details
parameter.- Returns:
- The authorisation details,
null
if not specified.
-
getStringParameter
public String getStringParameter(String name)
Returns the string parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value,
null
if not specified or if parsing failed.
-
getBooleanParameter
public boolean getBooleanParameter(String name) throws ParseException
Returns the boolean parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value.
- Throws:
ParseException
- If the parameter isn't specified or parsing failed.
-
getNumberParameter
public Number getNumberParameter(String name)
Returns the number parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value,
null
if not specified or parsing failed.
-
getStringListParameter
public List<String> getStringListParameter(String name)
Returns the string list parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value,
null
if not specified or if parsing failed.
-
getJSONObjectParameter
public net.minidev.json.JSONObject getJSONObjectParameter(String name)
Returns the JSON object parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value,
null
if not specified or if parsing failed.
-
getJSONArrayParameter
public net.minidev.json.JSONArray getJSONArrayParameter(String name)
Returns the JSON array parameter with the specified name.- Parameters:
name
- The parameter name. Must not benull
.- Returns:
- The parameter value,
null
if not specified or if parsing failed.
-
getParameters
public net.minidev.json.JSONObject getParameters()
Returns the underlying parameters.- Returns:
- The parameters, as JSON object.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this token introspection success response.Example JSON object:
{ "active" : true, "client_id" : "l238j323ds-23ij4", "username" : "jdoe", "scope" : "read write dolphin", "sub" : "Z5O3upPC88QrAjx00dis", "aud" : "https://protected.example.net/resource", "iss" : "https://server.example.com/", "exp" : 1419356238, "iat" : 1419350238, "extension_field" : "twenty-seven" }
- Returns:
- The JSON object.
-
indicatesSuccess
public boolean indicatesSuccess()
Description copied from interface:Response
Checks if the response indicates success.- Specified by:
indicatesSuccess
in interfaceResponse
- Returns:
true
if the response indicates success, elsefalse
.
-
toHTTPResponse
public HTTPResponse toHTTPResponse()
Description copied from interface:Response
Returns the matching HTTP response.- Specified by:
toHTTPResponse
in interfaceResponse
- Returns:
- The HTTP response.
-
parse
public static TokenIntrospectionSuccessResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
Parses a token introspection success response from the specified JSON object.- Parameters:
jsonObject
- The JSON object to parse. Must not benull
.- Returns:
- The token introspection success response.
- Throws:
ParseException
- If the JSON object couldn't be parsed to a token introspection success response.
-
parse
public static TokenIntrospectionSuccessResponse parse(HTTPResponse httpResponse) throws ParseException
Parses a token introspection success response from the specified HTTP response.- Parameters:
httpResponse
- The HTTP response. Must not benull
.- Returns:
- The token introspection success response.
- Throws:
ParseException
- If the HTTP response couldn't be parsed to a token introspection success response.
-
-