Created
January 9, 2014 08:54
-
-
Save letenkov/8331322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
/* other code left out for brevity */ | |
/** | |
* Configure HttpSecurity, adds a CsrfTokenGeneratorFilter after CsrfFilter. | |
* | |
* @param http | |
* @throws Exception | |
*/ | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http | |
.addFilterAfter(new CsrfTokenGeneratorFilter(), CsrfFilter.class) | |
.authorizeRequests() | |
.antMatchers("/scripts/**", "/styles/**", "/font/**", "/fonts/**").permitAll() | |
.antMatchers("/**").authenticated() | |
.and() | |
.formLogin() | |
.loginPage("/login").permitAll(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment