Klasse SecurityConfig
java.lang.Object
com.spaghetticodegang.trylater.security.SecurityConfig
Security configuration defining access rules, filters, and JWT-based authentication.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.springframework.security.authentication.AuthenticationManager
authenticationManager
(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration config) Provides the Spring SecurityAuthenticationManager
.jwtFilter
(JwtService jwtService, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, AuthCookieService authCookieService) Creates the custom JWT filter used for authenticating requests via token.org.springframework.security.crypto.password.PasswordEncoder
Configures the password encoder used for hashing user passwords.org.springframework.security.web.SecurityFilterChain
securityFilterChain
(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity, JwtFilter jwtFilter) Defines the main security filter chain, including access rules, stateless session management, CORS, and custom JWT authentication.
-
Konstruktordetails
-
SecurityConfig
public SecurityConfig()
-
-
Methodendetails
-
jwtFilter
@Bean public JwtFilter jwtFilter(JwtService jwtService, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, AuthCookieService authCookieService) Creates the custom JWT filter used for authenticating requests via token.- Parameter:
jwtService
- service for parsing and verifying JWTsuserDetailsService
- service for loading user dataauthCookieService
- service for managing auth cookies- Gibt zurück:
- the configured JWT filter
-
authenticationManager
@Bean public org.springframework.security.authentication.AuthenticationManager authenticationManager(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration config) throws Exception Provides the Spring SecurityAuthenticationManager
.- Parameter:
config
- the authentication configuration provided by Spring- Gibt zurück:
- the authentication manager
- Löst aus:
Exception
- if authentication setup fails
-
passwordEncoder
@Bean public org.springframework.security.crypto.password.PasswordEncoder passwordEncoder()Configures the password encoder used for hashing user passwords.- Gibt zurück:
- the BCrypt password encoder
-
securityFilterChain
@Bean public org.springframework.security.web.SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity, JwtFilter jwtFilter) throws Exception Defines the main security filter chain, including access rules, stateless session management, CORS, and custom JWT authentication.- Parameter:
httpSecurity
- the security HTTP builderjwtFilter
- the JWT authentication filter- Gibt zurück:
- the configured security filter chain
- Löst aus:
Exception
- if the configuration fails
-