Class UserAuthServiceImpl
java.lang.Object
it.univr.passportease.service.user.impl.UserAuthServiceImpl
- All Implemented Interfaces:
UserAuthService
Implementation of
UserAuthService, which provides methods for user authentication.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.security.authentication.AuthenticationManagerThe service that handles the authentication.private final CitizenRepositoryThe repository forCitizenentity.private final JwtServiceThe service that handles the JWT.private final MapUserThe service that maps theUserentity to theLoginOutputDTO.private org.springframework.security.crypto.password.PasswordEncoderThe service that encodes the password.private final UserRepositoryThe repository forUserentity. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLogs in the user.register(RegisterInput registerInput) Registers the user.
-
Field Details
-
userRepository
The repository forUserentity. -
citizenRepository
The repository forCitizenentity. -
mapUser
The service that maps theUserentity to theLoginOutputDTO. -
jwtService
The service that handles the JWT. -
passwordEncoder
private org.springframework.security.crypto.password.PasswordEncoder passwordEncoderThe service that encodes the password. -
authenticationManager
private org.springframework.security.authentication.AuthenticationManager authenticationManagerThe service that handles the authentication.
-
-
Constructor Details
-
UserAuthServiceImpl
public UserAuthServiceImpl()
-
-
Method Details
-
login
public LoginOutput login(String fiscalCode, String password) throws UserNotFoundException, WrongPasswordException Logs in the user.- Specified by:
loginin interfaceUserAuthService- Parameters:
fiscalCode- user fiscal codepassword- user password- Returns:
LoginOutputobject containing the access token and the refresh token- Throws:
UserNotFoundException- if the user is not foundWrongPasswordException- if the password is wrong
-
register
public LoginOutput register(RegisterInput registerInput) throws UserNotFoundException, UserAlreadyExistsException Registers the user.- Specified by:
registerin interfaceUserAuthService- Parameters:
registerInput-RegisterInputobject containing the user data- Returns:
LoginOutputobject containing the access token and the refresh token- Throws:
UserNotFoundException- if the user is not foundUserAlreadyExistsException- if the user already exists
-