Class Ltpa2Configurer
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<Ltpa2Configurer,org.springframework.security.config.annotation.web.builders.HttpSecurity>
de.sephirothj.spring.security.ltpa2.Ltpa2Configurer
- All Implemented Interfaces:
org.springframework.security.config.annotation.SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,
org.springframework.security.config.annotation.web.builders.HttpSecurity>
public class Ltpa2Configurer
extends org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<Ltpa2Configurer,org.springframework.security.config.annotation.web.builders.HttpSecurity>
A convenient way to configure the pre-authentication filter
.
How to use:
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/", "/home").permitAll() .antMatchers("/hello").hasRole("DEVELOPERS") .and() .apply(new Ltpa2Configurer()) .sharedKey(sharedKey()) .signerKey(signerKey()) ; http.userDetailsService(userDetailsService()); } }
A UserDetailsService
is required! In case no instance is exposed, you have to provide one using AuthenticationManagerBuilder#userDetailsService
.
- Author:
- Sephiroth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(org.springframework.security.config.annotation.web.builders.HttpSecurity builder) cookieName
(String cookieName) configures the name of the cookie expected to contain the LTPA2 tokenheaderName
(String headerName) configures the name of the header expected to contain the LTPA2 tokenMethods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
-
Constructor Details
-
Ltpa2Configurer
public Ltpa2Configurer()
-
-
Method Details
-
configure
public void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity builder) throws Exception - Specified by:
configure
in interfaceorg.springframework.security.config.annotation.SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,
org.springframework.security.config.annotation.web.builders.HttpSecurity> - Overrides:
configure
in classorg.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,
org.springframework.security.config.annotation.web.builders.HttpSecurity> - Throws:
Exception
-
cookieName
configures the name of the cookie expected to contain the LTPA2 token- Parameters:
cookieName
- the cookie name- Returns:
- this instance
- Throws:
IllegalArgumentException
- ifcookieName
is empty
-
headerName
configures the name of the header expected to contain the LTPA2 token- Parameters:
headerName
- the name of the header- Returns:
- this instance
- Throws:
IllegalArgumentException
- ifheaderName
is empty
-