Class TokenManagerJWT
- java.lang.Object
-
- de.fraunhofer.iosb.ilt.sta.service.TokenManagerJWT
-
- All Implemented Interfaces:
TokenManager<TokenManagerJWT>
public class TokenManagerJWT extends Object implements TokenManager<TokenManagerJWT>
A TokenManager for stateless JsonWebToken authentication as implemented by Kinota Server- See Also:
- Kinota Server
-
-
Constructor Summary
Constructors Constructor Description TokenManagerJWT()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuthHeader(org.apache.http.HttpRequest request)Add any headers to the request that are required Authentication and Authorisation.org.apache.http.impl.client.CloseableHttpClientgetHttpClient()Get the HTTP client this TokenManager uses to fetch tokens.StringgetToken()booleanisExpired()TokenManagerJWTsetHttpClient(org.apache.http.impl.client.CloseableHttpClient client)Set the HTTP client this TokenManager uses to fetch tokens.TokenManagerJWTsetJwtId(String jwtId)The ID to use for fetching tokens.TokenManagerJWTsetJwtKey(String jwtKey)Set the key to use for getting tokens.TokenManagerJWTsetTokenServerUrl(String tokenServerUrl)Set the URL to fetch tokens from.booleanvalidateToken(String token)
-
-
-
Method Detail
-
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
public String getToken()
-
validateToken
public boolean validateToken(String token)
-
setHttpClient
public TokenManagerJWT setHttpClient(org.apache.http.impl.client.CloseableHttpClient client)
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
public TokenManagerJWT setTokenServerUrl(String tokenServerUrl)
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
public TokenManagerJWT setJwtId(String jwtId)
The ID to use for fetching tokens.- Parameters:
jwtId- The ID on the JWT auth server.- Returns:
- this TokenManager
-
setJwtKey
public TokenManagerJWT setJwtKey(String jwtKey)
Set the key to use for getting tokens.- Parameters:
jwtKey- The key to use for getting tokens.- Returns:
- this TokenManager
-
-