Class TokenPairGeneratorImpl
java.lang.Object
com.example.blogs.app.api.auth.service.TokenPairGeneratorImpl
- All Implemented Interfaces:
TokenPairGenerator
Creates JWT token pairs with embedded user claims for access and refresh authentication flows.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateClaims(UserEntity user, String type) Creates JWT claims map from user entity data with token type.generateTokens(UserEntity user) Generates a complete token pair containing access and refresh tokens for the user.
-
Constructor Details
-
TokenPairGeneratorImpl
public TokenPairGeneratorImpl()
-
-
Method Details
-
generateTokens
Generates a complete token pair containing access and refresh tokens for the user. Uses UUID-based JTI as the JWT subject claim for token identification.- Specified by:
generateTokensin interfaceTokenPairGenerator- Parameters:
user- the user entity to generate tokens for- Returns:
- token pair with access and refresh tokens containing user claims
-
createClaims
Creates JWT claims map from user entity data with token type.- Specified by:
createClaimsin interfaceTokenPairGenerator- Parameters:
user- the user entity to extract claims fromtype- the token type ("access" or "refresh")- Returns:
- map of claims including id, username, email, profilePictureUrl, and type
-