Skip to content

Instantly share code, notes, and snippets.

@letenkov
Created January 9, 2014 08:54
Show Gist options
  • Save letenkov/8331322 to your computer and use it in GitHub Desktop.
Save letenkov/8331322 to your computer and use it in GitHub Desktop.
@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