Class TokenService
- java.lang.Object
-
- org.odpi.openmetadata.userinterface.uichassis.springboot.auth.RoleService
-
- org.odpi.openmetadata.userinterface.uichassis.springboot.auth.TokenService
-
- Direct Known Subclasses:
RedisAuthService,SessionAuthService,TokenAuthService
public class TokenService extends RoleService
-
-
Field Summary
Fields Modifier and Type Field Description protected StringtokenSecretprotected LongtokenTimeouttoken timout in minutes
-
Constructor Summary
Constructors Constructor Description TokenService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateTokenForUser(TokenUser user, String secret)TokenUserfromJSON(String userJSON)longgetTokenTimeout()TokenUserparseUserFromToken(String token, String secret)StringtoJSON(Object obj)-
Methods inherited from class org.odpi.openmetadata.userinterface.uichassis.springboot.auth.RoleService
extractUserAppRoles, getVisibleComponents
-
-
-
-
Method Detail
-
getTokenTimeout
public long getTokenTimeout()
- Returns:
- token timeout in milliseconds
-
toJSON
public String toJSON(Object obj)
- Parameters:
obj- the object to be serialized- Returns:
- the json string representing TokenUser
-
createTokenForUser
public String createTokenForUser(TokenUser user, String secret)
- Parameters:
user- the user to create token forsecret- the secret for signature- Returns:
- jwt token
-
parseUserFromToken
public TokenUser parseUserFromToken(String token, String secret)
- Parameters:
token- the encoded tokensecret- secret phrase to decode- Returns:
- parsed TokenUser
-
-