Package org.ctan.site.services.account
Class JwtManager
java.lang.Object
org.ctan.site.services.account.JwtManager
The class
JwtManager contains static utility methods for dealing
with JWTs.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.auth0.jwt.interfaces.JWTVerifierThe fieldVERIFIERcontains the verifier.protected static final com.auth0.jwt.interfaces.JWTVerifierThe fieldVERIFIERcontains the verifier. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateAuth(@NonNull String account) Create a JWT with standard options set for authentication.static StringcreateRefresh(@NonNull String account) Create a JWT with standard options set for refresh.static StringverifyAuth(String token) The methodverifyAuthprovides means to verify a JWT and return the account.static StringverifyRefresh(String token) The methodverifyprovides means to verify a JWT and return the account.
-
Field Details
-
VERIFIER_AUTH
protected static final com.auth0.jwt.interfaces.JWTVerifier VERIFIER_AUTHThe fieldVERIFIERcontains the verifier. It is visible outside for testing purpose. -
VERIFIER_REFRESH
protected static final com.auth0.jwt.interfaces.JWTVerifier VERIFIER_REFRESHThe fieldVERIFIERcontains the verifier. It is visible outside for testing purpose.
-
-
Method Details
-
createAuth
Create a JWT with standard options set for authentication.- Parameters:
account- the user id;- Returns:
- a new JWT
-
createRefresh
Create a JWT with standard options set for refresh.- Parameters:
account- the user id;- Returns:
- a new JWT
-
verifyAuth
The methodverifyAuthprovides means to verify a JWT and return the account.- Parameters:
token- the JWT- Returns:
- the verified user id or
null
-
verifyRefresh
The methodverifyprovides means to verify a JWT and return the account.- Parameters:
token- the JWT- Returns:
- the verified user id or
null
-