Package com.authlete.jaxrs
Class BaseResourceEndpoint
- java.lang.Object
-
- com.authlete.jaxrs.BaseEndpoint
-
- com.authlete.jaxrs.BaseResourceEndpoint
-
- Direct Known Subclasses:
BaseGrantManagementEndpoint
,BaseUserInfoEndpoint
public class BaseResourceEndpoint extends BaseEndpoint
A base class for protected resource endpoints.- Since:
- 1.2
- Author:
- Takahiko Kawasaki
-
-
Constructor Summary
Constructors Constructor Description BaseResourceEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
extractAccessToken(String authorization, String accessTokenInRequestParameters)
Extract an access token from eitherAuthorization
header or request parameters.com.authlete.common.dto.IntrospectionResponse
validateAccessToken(com.authlete.common.api.AuthleteApi api, com.authlete.common.dto.IntrospectionRequest request)
com.authlete.common.dto.IntrospectionResponse
validateAccessToken(com.authlete.common.api.AuthleteApi api, com.authlete.common.dto.IntrospectionRequest request, com.authlete.common.api.Options options)
AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, AccessTokenValidator.Params params)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, AccessTokenValidator.Params params, com.authlete.common.api.Options options)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, com.authlete.common.api.Options options)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, com.authlete.common.api.Options options)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject, com.authlete.common.api.Options options)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate)
Validate an access token.AccessTokenInfo
validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate, com.authlete.common.api.Options options)
Validate an access token.-
Methods inherited from class com.authlete.jaxrs.BaseEndpoint
extractClientCertificate, extractClientCertificateChain, extractHeadersAsPairs, onError, takeAttribute
-
-
-
-
Method Detail
-
extractAccessToken
public String extractAccessToken(String authorization, String accessTokenInRequestParameters)
Extract an access token from eitherAuthorization
header or request parameters.The first argument expects a value of
Authorization
header that complies with RFC 6750 (Bearer Token Usage). If the argument contains an access token, this method returns the access token without checking the second argument.The second argument expects a value of
access_token
request parameter. The value of this argument is returned when the first argument does not contain an access token.- Parameters:
authorization
- A value ofAuthorization
header whose scheme is Bearer or DPoP. For example,"Bearer SlAV32hkKG"
.accessTokenInRequestParameters
- A value ofaccess_token
request parameter.- Returns:
- An access token.
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, (Options)null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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.
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, null, options)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.accessToken
- An access token to validate.options
- The request options for the/api/auth/introspection
API.- 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
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, requiredScopes, (Options)null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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.
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, requiredScopes, null, options)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.accessToken
- An access token to validate.requiredScopes
- Scopes that must be associated with the access token.null
is okay.options
- The request options for the/api/auth/introspection
API.- 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
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, requiredScopes, requiredSubject, (Options)null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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.- 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.
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, requiredScopes, requiredSubject, null, null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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.options
- The request options for the/api/auth/introspection
API.- 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
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, String accessToken, String[] requiredScopes, String requiredSubject, String clientCertificate) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, accessToken, requiredScopes, requiredSubject, clientCertificate, null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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 given one does not match.
- Since:
- 2.8
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, 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 thevalidateAccessToken(AuthleteApi, AccessTokenValidator.Params)
method.- Parameters:
api
- Implementation ofAuthleteApi
interface.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.options
- The request options for the/api/auth/introspection
API.- 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 given one does not match.
- Since:
- 2.82
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, AccessTokenValidator.Params params) throws javax.ws.rs.WebApplicationException
Validate an access token. This method is an alias ofvalidateAccessToken
(api, params, null)
.- Parameters:
api
- Implementation ofAuthleteApi
interface.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
-
validateAccessToken
public AccessTokenInfo validateAccessToken(com.authlete.common.api.AuthleteApi api, AccessTokenValidator.Params params, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
Validate an access token.- Parameters:
api
- Implementation ofAuthleteApi
interface.params
- Parameters needed for access token validation.options
- The request options for the/api/auth/introspection
API.- Returns:
- Information about the access token.
- Throws:
javax.ws.rs.WebApplicationException
- The Access Token is invalid.- Since:
- 2.82
-
validateAccessToken
public com.authlete.common.dto.IntrospectionResponse validateAccessToken(com.authlete.common.api.AuthleteApi api, com.authlete.common.dto.IntrospectionRequest request) throws javax.ws.rs.WebApplicationException
- Throws:
javax.ws.rs.WebApplicationException
-
validateAccessToken
public com.authlete.common.dto.IntrospectionResponse validateAccessToken(com.authlete.common.api.AuthleteApi api, com.authlete.common.dto.IntrospectionRequest request, com.authlete.common.api.Options options) throws javax.ws.rs.WebApplicationException
- Throws:
javax.ws.rs.WebApplicationException
-
-