Class TokenManagerJWT
java.lang.Object
de.fraunhofer.iosb.ilt.frostclient.utils.TokenManagerJWT
- All Implemented Interfaces:
TokenManager<TokenManagerJWT>
A TokenManager for stateless JsonWebToken authentication as implemented by
Kinota Server
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthHeader(org.apache.http.HttpRequest request) Add any headers to the request that are required Authentication and Authorisation.org.apache.http.impl.client.CloseableHttpClientGet the HTTP client this TokenManager uses to fetch tokens.getToken()booleansetHttpClient(org.apache.http.impl.client.CloseableHttpClient client) Set the HTTP client this TokenManager uses to fetch tokens.The ID to use for fetching tokens.Set the key to use for getting tokens.setTokenServerUrl(String tokenServerUrl) Set the URL to fetch tokens from.booleanvalidateToken(String token)
-
Constructor Details
-
TokenManagerJWT
public TokenManagerJWT()
-
-
Method Details
-
addAuthHeader
public void addAuthHeader(org.apache.http.HttpRequest request) Add any headers to the request that are required Authentication and Authorisation.- Specified by:
addAuthHeaderin interfaceTokenManager<TokenManagerJWT>- Parameters:
request- The request to modify.
-
isExpired
public boolean isExpired() -
getToken
-
validateToken
-
setHttpClient
Set the HTTP client this TokenManager uses to fetch tokens.- Specified by:
setHttpClientin interfaceTokenManager<TokenManagerJWT>- Parameters:
client- The CloseableHttpClient to use for fetching Tokens.- Returns:
- this TokenManager
-
getHttpClient
public org.apache.http.impl.client.CloseableHttpClient getHttpClient()Get the HTTP client this TokenManager uses to fetch tokens.- Specified by:
getHttpClientin interfaceTokenManager<TokenManagerJWT>- Returns:
- The HTTP client this TokenManager uses to fetch tokens.
-
setTokenServerUrl
Set the URL to fetch tokens from. Usually in the form of http://example.com/auth/realms/{realm}/protocol/openid-connect/token- Parameters:
tokenServerUrl- The URL to fetch tokens from.- Returns:
- this TokenManager
-
setJwtId
The ID to use for fetching tokens.- Parameters:
jwtId- The ID on the JWT auth server.- Returns:
- this TokenManager
-
setJwtKey
Set the key to use for getting tokens.- Parameters:
jwtKey- The key to use for getting tokens.- Returns:
- this TokenManager
-