Class SecurityConfiguration
java.lang.Object
com.markvarga21.studentmanager.config.security.SecurityConfiguration
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
public class SecurityConfiguration
extends Object
Configuration class for setting up the security related
configurations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.authentication.AuthenticationManager
This method is used to create anAuthenticationManager
bean.org.springframework.security.authentication.AuthenticationProvider
This method is used to create anAuthenticationProvider
bean.org.springframework.web.cors.CorsConfigurationSource
This method is used to configure the CORS configuration source.org.springframework.security.crypto.password.PasswordEncoder
The password encoder bean.org.springframework.security.web.SecurityFilterChain
securityFilterChain
(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity) This method is used to configure the security filter chain.org.springframework.security.core.userdetails.UserDetailsService
This method is used to create aUserDetailsService
bean.
-
Constructor Details
-
SecurityConfiguration
public SecurityConfiguration()
-
-
Method Details
-
corsConfigurationSource
@Bean public org.springframework.web.cors.CorsConfigurationSource corsConfigurationSource()This method is used to configure the CORS configuration source.- Returns:
- The built
CorsConfigurationSource
object.
-
securityFilterChain
@Bean public org.springframework.security.web.SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity) throws Exception This method is used to configure the security filter chain.- Parameters:
httpSecurity
- TheHttpSecurity
object to configure the security filter chain.- Returns:
- The
SecurityFilterChain
object. - Throws:
Exception
-
authenticationManager
@Bean public org.springframework.security.authentication.AuthenticationManager authenticationManager()This method is used to create anAuthenticationManager
bean.- Returns:
- the created
AuthenticationManager
bean.
-
userDetailsService
@Bean public org.springframework.security.core.userdetails.UserDetailsService userDetailsService()This method is used to create aUserDetailsService
bean.- Returns:
- The
UserDetailsService
object.
-
authenticationProvider
@Bean public org.springframework.security.authentication.AuthenticationProvider authenticationProvider()This method is used to create anAuthenticationProvider
bean.- Returns:
- The
AuthenticationProvider
object.
-
passwordEncoder
@Bean public org.springframework.security.crypto.password.PasswordEncoder passwordEncoder()The password encoder bean.- Returns:
- a
BCryptPasswordEncoder
object.
-