Package xyz.zeroonebn.security
Class SecurityConfiguration
- java.lang.Object
-
- org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
-
- xyz.zeroonebn.security.SecurityConfiguration
-
- All Implemented Interfaces:
org.springframework.security.config.annotation.SecurityConfigurer<javax.servlet.Filter,org.springframework.security.config.annotation.web.builders.WebSecurity>,org.springframework.security.config.annotation.web.WebSecurityConfigurer<org.springframework.security.config.annotation.web.builders.WebSecurity>
@Configuration @EnableConfigurationProperties(SecurityProperties.class) @AutoConfigureBefore(org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class) public class SecurityConfiguration extends org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
Configures spring security, doing the following:- Bypass security checks for static resources,
- Restrict access to the application, allowing only logged in users,
- Set up the login form
-
-
Constructor Summary
Constructors Constructor Description SecurityConfiguration(SecurityProperties securityProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.authentication.AuthenticationManagerauthenticationManagerBean()protected voidconfigure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)Require login to access internal pages and configure login form.voidconfigure(org.springframework.security.config.annotation.web.builders.WebSecurity web)Allows access to static resources, bypassing Spring security.ConfigureUIServiceInitListenerconfigureUIServiceInitListener(SecurityUtils securityUtils)LoginViewloginView()LoginViewRegistrerloginViewRegistrer(SecurityProperties securityProperties)CustomRequestCacherequestCache(SecurityProperties securityProperties, SecurityUtils securityUtils)org.springframework.security.core.userdetails.UserDetailsServiceuserDetailsService()-
Methods inherited from class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
authenticationManager, configure, getApplicationContext, getHttp, init, setApplicationContext, setAuthenticationConfiguration, setContentNegotationStrategy, setObjectPostProcessor, setTrustResolver, userDetailsServiceBean
-
-
-
-
Constructor Detail
-
SecurityConfiguration
public SecurityConfiguration(SecurityProperties securityProperties)
-
-
Method Detail
-
configureUIServiceInitListener
@Bean public ConfigureUIServiceInitListener configureUIServiceInitListener(SecurityUtils securityUtils)
-
authenticationManagerBean
@Bean public org.springframework.security.authentication.AuthenticationManager authenticationManagerBean() throws java.lang.Exception- Overrides:
authenticationManagerBeanin classorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter- Throws:
java.lang.Exception
-
requestCache
@Bean public CustomRequestCache requestCache(SecurityProperties securityProperties, SecurityUtils securityUtils)
-
loginViewRegistrer
@Bean public LoginViewRegistrer loginViewRegistrer(SecurityProperties securityProperties)
-
loginView
@Bean @UIScope public LoginView loginView() throws java.lang.Exception
- Throws:
java.lang.Exception
-
configure
protected void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws java.lang.ExceptionRequire login to access internal pages and configure login form.- Overrides:
configurein classorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter- Throws:
java.lang.Exception
-
userDetailsService
@Bean("userDetailsService") @ConditionalOnMissingBean(org.springframework.security.core.userdetails.UserDetailsService.class) public org.springframework.security.core.userdetails.UserDetailsService userDetailsService()- Overrides:
userDetailsServicein classorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
-
configure
public void configure(org.springframework.security.config.annotation.web.builders.WebSecurity web)
Allows access to static resources, bypassing Spring security.- Specified by:
configurein interfaceorg.springframework.security.config.annotation.SecurityConfigurer<javax.servlet.Filter,org.springframework.security.config.annotation.web.builders.WebSecurity>- Overrides:
configurein classorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
-
-