Package org.odpi.openmetadata.userauthn
Class TokenService
java.lang.Object
org.odpi.openmetadata.userauthn.TokenService
Token service generates JWT bearer tokens for authenticated users.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longNumber of hours that a bearer token is valid for if the bearerTokenTimeout property is not set. -
Constructor Summary
ConstructorsConstructorDescriptionTokenService(org.springframework.security.oauth2.jwt.JwtEncoder encoder, Long bearerTokenTimeout) Constructor -
Method Summary
Modifier and TypeMethodDescriptiongenerateToken(org.springframework.security.core.Authentication authentication) Generate token
-
Field Details
-
DEFAULT_BEARER_TOKEN_TIMEOUT
public static final long DEFAULT_BEARER_TOKEN_TIMEOUTNumber of hours that a bearer token is valid for if the bearerTokenTimeout property is not set.- See Also:
-
-
Constructor Details
-
TokenService
public TokenService(org.springframework.security.oauth2.jwt.JwtEncoder encoder, @Value("${bearerTokenTimeout:1}") Long bearerTokenTimeout) Constructor- Parameters:
encoder- JWT encoderbearerTokenTimeout- number of hours that an issued bearer token remains valid. A null value means the property is not set and the default is used. A value that is not a positive number of hours is reported and the default is used as if the property was not set.
-
-
Method Details
-
generateToken
Generate token- Parameters:
authentication- information from the request- Returns:
- bearer token as a string
-