Class AuthenticationServiceImpl
java.lang.Object
com.bank.auth_service.service.impl.AuthenticationServiceImpl
- All Implemented Interfaces:
AuthenticationService
-
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationServiceImpl
(JwtService jwtService, UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, RefreshTokenService refreshTokenService, CodePublisher codePublisher) -
Method Summary
Modifier and TypeMethodDescriptiongetIpAddress
(jakarta.servlet.http.HttpServletRequest request) login
(LoginUserDto loginUserDto, jakarta.servlet.http.HttpServletRequest request) Authenticates a user using provided credentials and generates authentication tokens.refreshToken
(UUID refreshToken, jakarta.servlet.http.HttpServletRequest request) Issues a new authentication token using a valid refresh token.
-
Constructor Details
-
AuthenticationServiceImpl
public AuthenticationServiceImpl(JwtService jwtService, UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, RefreshTokenService refreshTokenService, CodePublisher codePublisher)
-
-
Method Details
-
login
public AuthenticationTokenDto login(LoginUserDto loginUserDto, jakarta.servlet.http.HttpServletRequest request) Description copied from interface:AuthenticationService
Authenticates a user using provided credentials and generates authentication tokens.- Specified by:
login
in interfaceAuthenticationService
- Parameters:
loginUserDto
- the login credentials including email and passwordrequest
- the HTTP servlet request containing client metadata (IP, user agent)- Returns:
AuthenticationTokenDto
containing the JWT and refresh tokens- See Also:
-
refreshToken
Description copied from interface:AuthenticationService
Issues a new authentication token using a valid refresh token.If the client's IP address or user agent differs significantly from the original login, the system may trigger a security alert to the user's email.
- Specified by:
refreshToken
in interfaceAuthenticationService
- Parameters:
refreshToken
- the UUID of the refresh token issued at loginrequest
- the HTTP servlet request containing client metadata- Returns:
- a new JWT authentication token as a String
- See Also:
-
getIpAddress
-