Package com.authlete.jaxrs
Class AccessTokenValidator
- java.lang.Object
-
- com.authlete.jaxrs.AccessTokenValidator
-
public class AccessTokenValidator extends Object
Access token validator.- Since:
- 1.2
- Author:
- Takahiko Kawasaki
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AccessTokenValidator.Params
Parameters passed to thevalidate(Params)
method.
-
Constructor Summary
Constructors Constructor Description AccessTokenValidator(com.authlete.common.api.AuthleteApi api)
Constructor with an implementation ofAuthleteApi
interface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.authlete.jaxrs.AuthleteApiCaller
getApiCaller()
protected javax.ws.rs.InternalServerErrorException
unexpected(String message, Throwable cause)
com.authlete.common.dto.IntrospectionResponse
validate(com.authlete.common.dto.IntrospectionRequest request)
Validate an access token.AccessTokenInfo
validate(AccessTokenValidator.Params params)
Validate an access token.AccessTokenInfo
validate(String accessToken)
Validate an access token.AccessTokenInfo
validate(String accessToken, String[] requiredScopes)
Validate an access token.AccessTokenInfo
validate(String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate)
Validate an access token.
-
-
-
Method Detail
-
validate
public AccessTokenInfo validate(String accessToken) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias of thevalidate(Params)
method. When the given access token is not valid, this method throws aWebApplicationException
. The response contained in the exception complies with the requirements described in RFC 6750 (The OAuth 2.0 Authorization Framework: Bearer Token Usage).- Parameters:
accessToken
- An access token to validate.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException
- The access token is invalid. To be concrete, the access token does not exist or it has expired.
-
validate
public AccessTokenInfo validate(String accessToken, String[] requiredScopes) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias of thevalidate(Params)
method. When the given access token is not valid, this method throws aWebApplicationException
. The response contained in the exception complies with the requirements described in RFC 6750 (The OAuth 2.0 Authorization Framework: Bearer Token Usage).- Parameters:
accessToken
- An access token to validate.requiredScopes
- Scopes that must be associated with the access token.null
is okay.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException
- The access token is invalid. To be concrete, one or more of the following conditions meet.- The access token does not exist.
- The access token has expired.
- The access token does not cover the required scopes.
-
validate
public AccessTokenInfo validate(String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias of thevalidate(Params)
method. When the given access token is not valid, this method throws aWebApplicationException
. The response contained in the exception complies with the requirements described in RFC 6750 (The OAuth 2.0 Authorization Framework: Bearer Token Usage).- Parameters:
accessToken
- An access token to validate.requiredScopes
- Scopes that must be associated with the access token.null
is okay.requiredSubject
- Subject (= user's unique identifier) that must be associated with the access token.null
is okay.clientCertificate
- TLS Certificate of the client presented during a call to the resource server, used with TLS-bound access tokens. Can benull
if no certificate is presented.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException
- The access token is invalid. To be concrete, one or more of the following conditions meet.- The access token does not exist.
- The access token has expired.
- The access token does not cover the required scopes.
- The access token is not associated with the required subject.
- The access token is bound to a client certificate, but the presented one does not match.
-
validate
public AccessTokenInfo validate(AccessTokenValidator.Params params) throws javax.ws.rs.WebApplicationException
Validate an access token.- Parameters:
params
- Parameters needed for access token validation.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException
- The access token is invalid.- Since:
- 2.27
-
validate
public com.authlete.common.dto.IntrospectionResponse validate(com.authlete.common.dto.IntrospectionRequest request) throws javax.ws.rs.WebApplicationException
Validate an access token.- Parameters:
request
- The request parameters to Authlete's/auth/introspection
API.- Returns:
- The response from the Authlete's
/auth/introspection
API. - Throws:
javax.ws.rs.WebApplicationException
- The access token is invalid or something unexpected happened. This exception is raised when theaction
response parameter in the response from the/auth/introspection
API is notOK
.- Since:
- 2.66
-
getApiCaller
protected com.authlete.jaxrs.AuthleteApiCaller getApiCaller()
-
-