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 Details

    • createRefreshToken

      String createRefreshToken(String ip, String userAgent, User user)
      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 address
      userAgent - the client's user agent string
      user - the user for whom the refresh token is created
      Returns:
      the created refresh token as a String
    • validateRefreshToken

      RefreshToken validateRefreshToken(UUID refreshToken)
      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 RefreshToken if valid
      Throws:
      RefreshTokenNotFoundException - if the token does not exist
      RefreshTokenExpiredException - if the token has expired