Package com.bank.auth_service.service
Interface RefreshTokenService
- All Known Implementing Classes:
RefreshTokenServiceImpl
public interface RefreshTokenService
Service interface for operations related to refresh tokens.
Provides methods to create and validate refresh tokens associated with a user session.
A refresh token allows users to obtain new JWT tokens without logging in again.
- Since:
- 1.0.0
- Version:
- 1.0.0, 06/23/2025
- Author:
- Fernando Cruz Cavina
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateRefreshToken(String ip, String userAgent, User user) Creates a new refresh token valid for 7 days.validateRefreshToken(UUID refreshToken) Validates the provided refresh token.
-
Method Details
-
createRefreshToken
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.- 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
Validates the provided refresh token. Checks if the token exists and has not expired.- Parameters:
refreshToken- the UUID of the refresh token- Returns:
- the corresponding
RefreshTokenif valid - Throws:
RefreshTokenNotFoundException- if the token does not existRefreshTokenExpiredException- if the token has expired
-