Class RefreshTokenServiceImpl
java.lang.Object
com.bank.auth_service.service.impl.RefreshTokenServiceImpl
- All Implemented Interfaces:
RefreshTokenService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateRefreshToken
(String ip, String userAgent, User user) Creates a new refresh token valid for 7 days.validateRefreshToken
(UUID token) Validates the provided refresh token.
-
Constructor Details
-
RefreshTokenServiceImpl
-
-
Method Details
-
createRefreshToken
Description copied from interface:RefreshTokenService
Creates a new refresh token valid for 7 days. Associates the token with the user, and stores session metadata such as IP address and user agent.- Specified by:
createRefreshToken
in interfaceRefreshTokenService
- Parameters:
ip
- the client's IP addressuserAgent
- the client's user agent stringuser
- the user for whom the refresh token is created- Returns:
- the created refresh token as a String
-
validateRefreshToken
Description copied from interface:RefreshTokenService
Validates the provided refresh token. Checks if the token exists and has not expired.- Specified by:
validateRefreshToken
in interfaceRefreshTokenService
- Parameters:
token
- the UUID of the refresh token- Returns:
- the corresponding
RefreshToken
if valid
-