Class JwtResponseDto
java.lang.Object
me.josephsf.jobportaljosephsfeir.dto.JwtResponseDto
Data Transfer Object for JWT authentication response.
This class encapsulates the information returned to the client after successful authentication. It includes the JWT token, user identification details, and assigned roles.
The response includes:
- JWT access token for authenticating subsequent requests
- Token type (always "Bearer")
- User ID from the database
- Username used for authentication
- User email
- List of user roles
- Since:
- 2025-05-14
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the JWT access token.getEmail()Gets the user email address.getId()Gets the MongoDB user ID.getRoles()Gets the list of user roles.Gets the token type, always "Bearer".Gets the username used for authentication.voidsetAccessToken(String accessToken) Sets the JWT access token.voidSets the user email address.voidSets the MongoDB user ID.voidSets the list of user roles.voidsetTokenType(String tokenType) Sets the token type.voidsetUsername(String username) Sets the username.
-
Constructor Details
-
JwtResponseDto
public JwtResponseDto(String accessToken, String id, String username, String email, List<String> roles) Constructs a new JwtResponseDto with all required fields.- Parameters:
accessToken- JWT access tokenid- MongoDB user IDusername- Username used for authenticationemail- User email addressroles- List of user roles
-
-
Method Details
-
getAccessToken
Gets the JWT access token.- Returns:
- The JWT access token
-
setAccessToken
Sets the JWT access token.- Parameters:
accessToken- The JWT access token
-
getTokenType
Gets the token type, always "Bearer".- Returns:
- The token type
-
setTokenType
Sets the token type.- Parameters:
tokenType- The token type
-
getId
Gets the MongoDB user ID.- Returns:
- The user ID
-
setId
Sets the MongoDB user ID.- Parameters:
id- The user ID
-
getEmail
Gets the user email address.- Returns:
- The user email
-
setEmail
Sets the user email address.- Parameters:
email- The user email
-
getUsername
Gets the username used for authentication.- Returns:
- The username
-
setUsername
Sets the username.- Parameters:
username- The username
-
getRoles
Gets the list of user roles.- Returns:
- List of roles as strings
-
setRoles
Sets the list of user roles.- Parameters:
roles- List of roles
-