Class ApplicationConfig

java.lang.Object
app.YUP.config.ApplicationConfig

@Configuration public class ApplicationConfig extends Object
Configuration class for the application. This class is responsible for setting up the security configuration of the application. It defines beans for UserDetailsService, AuthenticationProvider, AuthenticationManager, and PasswordEncoder.
  • Constructor Details

    • ApplicationConfig

      public ApplicationConfig()
  • Method Details

    • userDetailsService

      @Bean public org.springframework.security.core.userdetails.UserDetailsService userDetailsService(InternalUserRepository internalUserRepository)
      Bean definition for UserDetailsService. This service is used for loading user-specific data. It throws UsernameNotFoundException if the user is not found in the database.
      Returns:
      the UserDetailsService instance
    • authenticationProvider

      @Bean public org.springframework.security.authentication.AuthenticationProvider authenticationProvider()
      Bean definition for AuthenticationProvider. This provider is used for authenticating a UserDetails. It uses DaoAuthenticationProvider which retrieves user details from a UserDetailsService.
      Returns:
      the AuthenticationProvider instance
    • authenticationManager

      @Bean public org.springframework.security.authentication.AuthenticationManager authenticationManager(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration authenticationConfiguration) throws Exception
      Bean definition for AuthenticationManager. This manager is used for authenticating a user in the application.
      Parameters:
      authenticationConfiguration - the AuthenticationConfiguration instance
      Returns:
      the AuthenticationManager instance
      Throws:
      Exception - if an error occurs while getting the AuthenticationManager
    • passwordEncoder

      @Bean public org.springframework.security.crypto.password.PasswordEncoder passwordEncoder()
      Bean definition for PasswordEncoder. This encoder (BCryptPasswordEncoder) is used for hashing passwords.
      Returns:
      the PasswordEncoder instance
    • externalProviderUserService

      @Bean public ExternalProviderUserService externalProviderUserService()
      Creates an instance of the ExternalProviderUserService class. This class is responsible for handling user operations related to external providers.
      Returns:
      an instance of ExternalProviderUserService
    • externalProviderAuthenticationSuccessHandler

      @Bean public ExternalProviderAuthenticationSuccessHandler externalProviderAuthenticationSuccessHandler(ExternalUserService externalUserService)
      Creates an instance of the ExternalProviderAuthenticationSuccessHandler class. This class is responsible for handling the success scenario of authentication with external providers.
      Parameters:
      externalUserService - an instance of ExternalUserService, used to perform operations related to external users
      Returns:
      an instance of ExternalProviderAuthenticationSuccessHandler