Skip to content

Instantly share code, notes, and snippets.

@altfatterz
Last active August 29, 2015 13:56
Show Gist options
  • Save altfatterz/9152772 to your computer and use it in GitHub Desktop.
Save altfatterz/9152772 to your computer and use it in GitHub Desktop.
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/signup", "/static/**").permitAll()
.antMatchers("/code").hasRole("PRE_AUTH_USER")
.antMatchers("/home").hasRole("USER")
.anyRequest().authenticated();
http.formLogin()
.loginPage("/login")
.permitAll()
// always use the default success url despite if a protected page had been previously visited
.defaultSuccessUrl("/code", true)
.and()
.logout()
.permitAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment