Package org.forgerock.oauth2.core
Class AccessTokenVerifier
- java.lang.Object
-
- org.forgerock.oauth2.core.AccessTokenVerifier
-
- Direct Known Subclasses:
RestletFormBodyAccessTokenVerifier,RestletHeaderAccessTokenVerifier,RestletQueryParameterAccessTokenVerifier
public abstract class AccessTokenVerifier extends Object
Verifies that a OAuth2 request that is made to one of the protected endpoints on the OAuth2 provider, (i.e. tokeninfo, userinfo) contains a valid access token.- Since:
- 12.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccessTokenVerifier.TokenStateRepresents the state of the token on the request.
-
Field Summary
Fields Modifier and Type Field Description static StringFORM_BODYstatic StringHEADERprotected org.slf4j.Loggerloggerstatic StringQUERY_PARAMstatic StringREALM_AGNOSTIC_FORM_BODYAnAccessTokenVerifierthat verifies the OAuth2 access token provided in the request payload without checking the realm corresponding to theOAuth2Request.static StringREALM_AGNOSTIC_HEADERAnAccessTokenVerifierthat verifies the OAuth2 access token provided in a header without checking the realm corresponding to theOAuth2Request.static StringREALM_AGNOSTIC_QUERY_PARAMAnAccessTokenVerifierthat verifies the OAuth2 access token provided in the query parameter without checking the realm corresponding to theOAuth2Request.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAccessTokenVerifier(TokenStore tokenStore)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract StringobtainTokenId(OAuth2Request request)Obtain the token ID from the request.AccessTokenVerifier.TokenStateverify(OAuth2Request request)Verifies that the specified OAuth2 request contains a valid access token which has not expired.
-
-
-
Field Detail
-
HEADER
public static final String HEADER
- See Also:
- Constant Field Values
-
REALM_AGNOSTIC_HEADER
public static final String REALM_AGNOSTIC_HEADER
AnAccessTokenVerifierthat verifies the OAuth2 access token provided in a header without checking the realm corresponding to theOAuth2Request.- See Also:
- Constant Field Values
-
FORM_BODY
public static final String FORM_BODY
- See Also:
- Constant Field Values
-
REALM_AGNOSTIC_FORM_BODY
public static final String REALM_AGNOSTIC_FORM_BODY
AnAccessTokenVerifierthat verifies the OAuth2 access token provided in the request payload without checking the realm corresponding to theOAuth2Request.- See Also:
- Constant Field Values
-
QUERY_PARAM
public static final String QUERY_PARAM
- See Also:
- Constant Field Values
-
REALM_AGNOSTIC_QUERY_PARAM
public static final String REALM_AGNOSTIC_QUERY_PARAM
AnAccessTokenVerifierthat verifies the OAuth2 access token provided in the query parameter without checking the realm corresponding to theOAuth2Request.- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Detail
-
AccessTokenVerifier
protected AccessTokenVerifier(TokenStore tokenStore)
-
-
Method Detail
-
verify
public AccessTokenVerifier.TokenState verify(OAuth2Request request)
Verifies that the specified OAuth2 request contains a valid access token which has not expired.- Parameters:
request- The OAuth2 request. Must not benull.- Returns:
trueif the request contains an access token which is valid and has not expired.
-
obtainTokenId
protected abstract String obtainTokenId(OAuth2Request request)
Obtain the token ID from the request.- Parameters:
request- The OAuth2 request. Must not benull.- Returns:
- The String access token ID.
-
-