Interface JwtTokenService
- All Known Implementing Classes:
JwtTokenServiceImpl
public interface JwtTokenService
- Author:
- Flyur Karimov
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkRefreshToken
(Token token) createAccessToken
(String userAccountId, boolean simpleCredentials) Creates a token with a short duration Needed to requests authorization It must be stored on client sidecreateRefreshToken
(String userAccountId, boolean simpleCredentials) Creates a token with a long duration Needed to refresh access token It must be stored on client and backend sidevoid
deleteRefreshToken
(String accessToken) Delete refresh token from DB after logoutgetCredentials
(boolean simpleCredentials, String userAccountIdFromToken) boolean
boolean
Validates token Check userAccountId existing and token expiration timevoid
saveRefreshToken
(String userAccountId, Token newToken, String accessToken) Save refresh token in storagevoid
updateRefreshToken
(String userAccountId, Token newToken, String oldToken, String accessToken) Update refresh token in storage
-
Method Details
-
createAccessToken
Creates a token with a short duration Needed to requests authorization It must be stored on client side- Parameters:
userAccountId
- - userAccountIdsimpleCredentials
- - Is the credentials stored in simple_credentials table- Returns:
- access token
-
createRefreshToken
Creates a token with a long duration Needed to refresh access token It must be stored on client and backend side- Parameters:
userAccountId
- - userAccountIdsimpleCredentials
- - simpleCredentials- Returns:
- refresh token
-
isValid
-
isValid
Validates token Check userAccountId existing and token expiration time- Parameters:
token
- token- Returns:
- true for valid token, else false
-
checkRefreshToken
-
getCredentials
-
saveRefreshToken
Save refresh token in storage- Parameters:
userAccountId
- - user account idnewToken
- new refresh tokenaccessToken
- - access token
-
updateRefreshToken
Update refresh token in storage- Parameters:
userAccountId
- - user account idnewToken
- new refresh tokenoldToken
- old refresh tokenaccessToken
- - access token
-
deleteRefreshToken
Delete refresh token from DB after logout- Parameters:
accessToken
- - access token
-
getToken
-