Class JKWebSecurityConfig

java.lang.Object
com.jk.webstack.security.JKWebSecurityConfig

@EnableWebSecurity @Configuration public class JKWebSecurityConfig extends Object
This class configures security settings for the web application.

It defines security filters, access control, login/logout handling, and more based on the application's security configuration.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.authentication.AuthenticationProvider
    This method defines the AuthenticationProvider for user authentication.
    org.springframework.security.web.SecurityFilterChain
    configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    This method configures the security filter chain for HTTP requests.
    void
    configureGlobal(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth)
    This method configures the global AuthenticationManagerBuilder.
    org.springframework.security.web.firewall.HttpFirewall
    This method defines the default HTTP fire-wall for web security.
    org.springframework.security.crypto.password.PasswordEncoder
    This method defines the password encoder for handling user password encryption.
    jakarta.servlet.ServletContext
    This method retrieves the ServletContext for the application.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JKWebSecurityConfig

      public JKWebSecurityConfig()
  • Method Details

    • configure

      @Bean public org.springframework.security.web.SecurityFilterChain configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      This method configures the security filter chain for HTTP requests.
      Parameters:
      http - Specifies the HttpSecurity object to configure.
      Returns:
      the SecurityFilterChain defining the security configuration.
      Throws:
      Exception - if configuration setup encounters an exception.
    • configureGlobal

      @Autowired public void configureGlobal(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth) throws Exception
      This method configures the global AuthenticationManagerBuilder.
      Parameters:
      auth - Specifies the AuthenticationManagerBuilder object to configure.
      Throws:
      Exception - if configuration setup encounters an exception.
    • authenticationProvider

      @Bean public org.springframework.security.authentication.AuthenticationProvider authenticationProvider()
      This method defines the AuthenticationProvider for user authentication.
      Returns:
      an AuthenticationProvider configured for user authentication.
    • encoder

      @Bean public org.springframework.security.crypto.password.PasswordEncoder encoder()
      This method defines the password encoder for handling user password encryption.
      Returns:
      a PasswordEncoder for password encryption.
    • defaultHttpFirewall

      @Bean public org.springframework.security.web.firewall.HttpFirewall defaultHttpFirewall()
      This method defines the default HTTP fire-wall for web security.
      Returns:
      the HttpFirewall representing the default HTTP fire-wall.
    • getServletContext

      @Bean public jakarta.servlet.ServletContext getServletContext()
      This method retrieves the ServletContext for the application.
      Returns:
      the ServletContext object for the application.