Skip to content

Instantly share code, notes, and snippets.

@sw-samuraj
Last active January 22, 2018 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw-samuraj/4a2819e4ad4af9edd3584c8f3983527c to your computer and use it in GitHub Desktop.
Save sw-samuraj/4a2819e4ad4af9edd3584c8f3983527c to your computer and use it in GitHub Desktop.
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf()
.disable();
http
.addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class)
.addFilterAfter(samlFilter(), BasicAuthenticationFilter.class);
http.authorizeRequests()
.antMatchers("/")
.permitAll()
.antMatchers("/user")
.authenticated().and()
.formLogin()
.loginPage("/saml/login");
http.logout()
.logoutSuccessUrl("/");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment