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 void
addAuthHeader(org.apache.http.HttpRequest request)
Add any headers to the request that are required Authentication and Authorisation.org.apache.http.impl.client.CloseableHttpClient
getHttpClient()
Get the HTTP client this TokenManager uses to fetch tokens.String
getToken()
boolean
isExpired()
TokenManagerJWT
setHttpClient(org.apache.http.impl.client.CloseableHttpClient client)
Set the HTTP client this TokenManager uses to fetch tokens.TokenManagerJWT
setJwtId(String jwtId)
The ID to use for fetching tokens.TokenManagerJWT
setJwtKey(String jwtKey)
Set the key to use for getting tokens.TokenManagerJWT
setTokenServerUrl(String tokenServerUrl)
Set the URL to fetch tokens from.boolean
validateToken(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:
addAuthHeader
in 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:
setHttpClient
in 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:
getHttpClient
in 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
-
-