Class SecurityConfig

java.lang.Object
fr.utc.miage.sporttrack.config.SecurityConfig

@Configuration @EnableWebSecurity public class SecurityConfig extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.crypto.password.PasswordEncoder
    Provides a BCrypt-based password encoder bean for hashing and verifying passwords throughout the application.
    org.springframework.security.web.SecurityFilterChain
    securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Configures the HTTP security filter chain including URL-based authorisation, form login, and logout behaviour.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - the HttpSecurity builder 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 BCryptPasswordEncoder instance