Package app.YUP.config
Class ApplicationConfig
java.lang.Object
app.YUP.config.ApplicationConfig
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.authentication.AuthenticationManagerauthenticationManager(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration authenticationConfiguration) Bean definition for AuthenticationManager.org.springframework.security.authentication.AuthenticationProviderBean definition for AuthenticationProvider.externalProviderAuthenticationSuccessHandler(ExternalUserService externalUserService) Creates an instance of the ExternalProviderAuthenticationSuccessHandler class.Creates an instance of the ExternalProviderUserService class.org.springframework.security.crypto.password.PasswordEncoderBean definition for PasswordEncoder.org.springframework.security.core.userdetails.UserDetailsServiceuserDetailsService(InternalUserRepository internalUserRepository) Bean definition for UserDetailsService.
-
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
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
-