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 classAccessTokenValidator.ParamsParameters passed to thevalidate(Params)method.
-
Constructor Summary
Constructors Constructor Description AccessTokenValidator(com.authlete.common.api.AuthleteApi api)Constructor with an implementation ofAuthleteApiinterface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.authlete.jaxrs.AuthleteApiCallergetApiCaller()protected javax.ws.rs.InternalServerErrorExceptionunexpected(String message, Throwable cause)com.authlete.common.dto.IntrospectionResponsevalidate(com.authlete.common.dto.IntrospectionRequest request)Validate an access token.com.authlete.common.dto.IntrospectionResponsevalidate(com.authlete.common.dto.IntrospectionRequest request, com.authlete.common.api.Options options)Validate an access token.AccessTokenInfovalidate(AccessTokenValidator.Params params)Validate an access token.AccessTokenInfovalidate(AccessTokenValidator.Params params, com.authlete.common.api.Options options)Validate an access token.AccessTokenInfovalidate(String accessToken)Validate an access token.AccessTokenInfovalidate(String accessToken, com.authlete.common.api.Options options)Validate an access token.AccessTokenInfovalidate(String accessToken, String[] requiredScopes)Validate an access token.AccessTokenInfovalidate(String accessToken, String[] requiredScopes, com.authlete.common.api.Options options)Validate an access token.AccessTokenInfovalidate(String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate)Validate an access token.AccessTokenInfovalidate(String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate, com.authlete.common.api.Options options)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 ofvalidate(accessToken, (Options)null).- 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, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidate(accessToken, null, options).When the given access token is not valid, this method throws a
WebApplicationException. 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.options- The request options for the/api/auth/introspectionAPI.- 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.- Since:
- 2.82
-
validate
public AccessTokenInfo validate(String accessToken, String[] requiredScopes) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidate(accessToken, requiredScopes, null).- Parameters:
accessToken- An access token to validate.requiredScopes- Scopes that must be associated with the access token.nullis 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, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidate(accessToken, requiredScopes, null, null, options).- Parameters:
accessToken- An access token to validate.requiredScopes- Scopes that must be associated with the access token.nullis okay.options- The request options for the/api/auth/introspectionAPI.- 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.
- Since:
- 2.82
-
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 ofvalidate(accessToken, requiredScopes, requiredSubject, clientCertificate, null).- Parameters:
accessToken- An access token to validate.requiredScopes- Scopes that must be associated with the access token.nullis okay.requiredSubject- Subject (= user's unique identifier) that must be associated with the access token.nullis okay.clientCertificate- TLS Certificate of the client presented during a call to the resource server, used with TLS-bound access tokens. Can benullif 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.
- Since:
- 2.27
-
validate
public AccessTokenInfo validate(String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias of thevalidate(Params, Options)method.When the given access token is not valid, this method throws a
WebApplicationException. 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.nullis okay.requiredSubject- Subject (= user's unique identifier) that must be associated with the access token.nullis okay.clientCertificate- TLS Certificate of the client presented during a call to the resource server, used with TLS-bound access tokens. Can benullif no certificate is presented.options- The request options for the/api/auth/introspectionAPI.- 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.
- Since:
- 2.82
-
validate
public AccessTokenInfo validate(AccessTokenValidator.Params params) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias of thevalidate(Params, Options)method.- Parameters:
params- The request 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 AccessTokenInfo validate(AccessTokenValidator.Params params, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token.- Parameters:
params- The request parameters needed for access token validation.options- The request options for the/api/auth/introspectionAPI.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException- The access token is invalid.- Since:
- 2.82
-
validate
public com.authlete.common.dto.IntrospectionResponse validate(com.authlete.common.dto.IntrospectionRequest request) throws javax.ws.rs.WebApplicationExceptionValidate an access token. This method is an alias of thevalidate(request, null).- Parameters:
request- The request parameters for the/api/auth/introspectionAPI.- Returns:
- The response from the
/api/auth/introspectionAPI. - Throws:
javax.ws.rs.WebApplicationException- The access token is invalid or something unexpected happened. This exception is raised when theactionresponse parameter in the response from the/auth/introspectionAPI is notOK.- Since:
- 2.66
-
validate
public com.authlete.common.dto.IntrospectionResponse validate(com.authlete.common.dto.IntrospectionRequest request, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationExceptionValidate an access token.- Parameters:
request- The request parameters for the/api/auth/introspectionAPI.options- The request options for the/api/auth/introspectionAPI.- Returns:
- The response from the
/api/auth/introspectionAPI. - Throws:
javax.ws.rs.WebApplicationException- The access token is invalid or something unexpected happened. This exception is raised when theactionresponse parameter in the response from the/api/auth/introspectionAPI is notOK.- Since:
- 2.82
-
getApiCaller
protected com.authlete.jaxrs.AuthleteApiCaller getApiCaller()
-
-