Package fr.utc.miage.sporttrack.config
Class SecurityConfig
java.lang.Object
fr.utc.miage.sporttrack.config.SecurityConfig
Spring Security configuration class for the SportTrack application.
Defines the HTTP security rules, form-based authentication flow,
and password encoding strategy. Public access is granted to the home,
registration, login, and static resource endpoints. Admin endpoints
require the ADMIN role, athlete endpoints require the
USER role, and all other endpoints require authentication.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.crypto.password.PasswordEncoderProvides a BCrypt-based password encoder bean for hashing and verifying passwords throughout the application.org.springframework.security.web.SecurityFilterChainsecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Configures the HTTP security filter chain including URL-based authorisation, form login, and logout behaviour.
-
Constructor Details
-
SecurityConfig
public SecurityConfig()
-
-
Method Details
-
securityFilterChain
@Bean public org.springframework.security.web.SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception Configures the HTTP security filter chain including URL-based authorisation, form login, and logout behaviour.- Parameters:
http- theHttpSecuritybuilder to configure- Returns:
- the built
SecurityFilterChain - Throws:
Exception- if an error occurs during configuration
-
passwordEncoder
@Bean public org.springframework.security.crypto.password.PasswordEncoder passwordEncoder()Provides a BCrypt-based password encoder bean for hashing and verifying passwords throughout the application.- Returns:
- a
BCryptPasswordEncoderinstance
-