Class AuthServiceImpl

All Implemented Interfaces:
AuthService

@Service public class AuthServiceImpl extends FinancialDataGenerator implements AuthService
This class implements the AuthService interface and provides functionalities for user authentication and registration within the banking application. It manages user profiles, authentication tokens, and ensures data validation during the signup and login processes.
  • Constructor Details

    • AuthServiceImpl

      public AuthServiceImpl(UserProfileRepository userProfileRepository, org.springframework.security.authentication.AuthenticationManager authenticationManager, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, CurrencyDataRepository currencyDataRepository, GenerateAccessToken generateAccessToken, UserDataValidator userDataValidator)
      Constructor for the AuthServiceImpl class.
      Parameters:
      userProfileRepository - Repository for user profile operations.
      authenticationManager - Manages the authentication processes.
      passwordEncoder - Encodes user passwords for secure storage.
      currencyDataRepository - Repository for currency data operations.
      generateAccessToken - Generates access tokens for authenticated users.
      userDataValidator - Validates user data during registration.
  • Method Details

    • signUp

      public JwtAuthResponse signUp(UserProfileRequest request) throws Exception
      Registers a new user profile in the system.
      Specified by:
      signUp in interface AuthService
      Parameters:
      request - Contains the user profile details to register.
      Returns:
      JwtAuthResponse containing the generated JWT token and its expiration details.
      Throws:
      Exception - if there is an error during the registration process.
    • authenticate

      public JwtAuthResponse authenticate(UserLoginRequest request)
      Authenticates an existing user and generates an access token.
      Specified by:
      authenticate in interface AuthService
      Parameters:
      request - Contains the login credentials (email and password).
      Returns:
      JwtAuthResponse containing the generated JWT token and its expiration details.