Class SecurityConfig

java.lang.Object
edu.ntnu.idatt2106_2023_06.backend.config.SecurityConfig

@Configuration @EnableWebSecurity public class SecurityConfig extends Object
Configuration class for Spring Security. Enables Web Security and provides a SecurityFilterChain bean. Uses a JwtAuthenticationFilter for authentication and an AuthenticationProvider for authentication management.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.servlet.config.annotation.WebMvcConfigurer
    Configures CORS mapping for the application.
    org.springframework.security.web.SecurityFilterChain
    securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Configures the security filter chain.

    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 security filter chain.
      Parameters:
      http - HttpSecurity object used for configuration
      Returns:
      A SecurityFilterChain object
      Throws:
      Exception
    • corsConfigurer

      @Bean public org.springframework.web.servlet.config.annotation.WebMvcConfigurer corsConfigurer()
      Configures CORS mapping for the application.
      Returns:
      A WebMvcConfigurer object