Class SecurityConfig

java.lang.Object
no.idata1002.group19.SecurityConfig

@Configuration @EnableWebSecurity public class SecurityConfig extends Object
Represents security configuration class for Spring Security, the class is responsible for configuring the security settings and the components of the application.
Since:
16.04.2023
Version:
25.04.2023
Author:
Group19
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configureGlobal(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth)
    This method will be called automatically by the framework to find out what authentication to use.
    org.springframework.security.web.SecurityFilterChain
    filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    This method will be called automatically by the framework to find out what authentication to use.
    org.springframework.security.authentication.AuthenticationManager
    getAuthenticationManager(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Configures the AuthenticationManager instance and returns it.

    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

    • configureGlobal

      @Autowired public void configureGlobal(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth) throws Exception
      This method will be called automatically by the framework to find out what authentication to use. Here we tell that we want to load users from a database.
      Parameters:
      auth - Authentication builder used for authenticating users.
      Throws:
      Exception - upon failed authentication of user details.
    • getAuthenticationManager

      @Bean public org.springframework.security.authentication.AuthenticationManager getAuthenticationManager(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      Configures the AuthenticationManager instance and returns it.
      Parameters:
      http - An HttpSecurity instance to configure the AuthenticationManager instance.
      Returns:
      An AuthenticationManager instance.
      Throws:
      Exception
    • filterChain

      @Bean public org.springframework.security.web.SecurityFilterChain filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      This method will be called automatically by the framework to find out what authentication to use.
      Parameters:
      http - HttpSecurity setting builder.
      Throws:
      Exception - if an error occurs upon configuring the server security profile.