Package io.smallrye.jwt.auth
Class AbstractBearerTokenExtractor
- java.lang.Object
-
- io.smallrye.jwt.auth.AbstractBearerTokenExtractor
-
public abstract class AbstractBearerTokenExtractor extends Object
Common functionality for classes extracting Bearer tokens from HTTP request headers (including Cookie) and converting the token string to aJsonWebToken.- Author:
- Michael Edgar <michael@xlate.io>
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringAUTHORIZATION_HEADERprotected static StringBEARERprotected static StringBEARER_SCHEME_PREFIXprotected static StringCOOKIE_HEADER
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBearerTokenExtractor(JWTAuthContextInfo authContextInfo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetBearerToken()Find a JWT Bearer token in the request by referencing the configurations found in theJWTAuthContextInfo.protected abstract StringgetCookieValue(String cookieName)Retrieve an HTTP request cookie value by name.protected abstract StringgetHeaderValue(String headerName)Retrieve an HTTP request header by name.
-
-
-
Field Detail
-
AUTHORIZATION_HEADER
protected static final String AUTHORIZATION_HEADER
- See Also:
- Constant Field Values
-
COOKIE_HEADER
protected static final String COOKIE_HEADER
- See Also:
- Constant Field Values
-
BEARER
protected static final String BEARER
- See Also:
- Constant Field Values
-
BEARER_SCHEME_PREFIX
protected static final String BEARER_SCHEME_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractBearerTokenExtractor
protected AbstractBearerTokenExtractor(JWTAuthContextInfo authContextInfo)
-
-
Method Detail
-
getBearerToken
public String getBearerToken()
Find a JWT Bearer token in the request by referencing the configurations found in theJWTAuthContextInfo. The resulting token may be found in a cookie or another HTTP header, either explicitly configured or the default 'Authorization' header.- Returns:
- a JWT Bearer token or null if not found
-
getHeaderValue
protected abstract String getHeaderValue(String headerName)
Retrieve an HTTP request header by name.- Parameters:
headerName- name of the header- Returns:
- value of the header
-
-