Example usage for org.springframework.security.config.annotation.web.builders HttpSecurity antMatcher

List of usage examples for org.springframework.security.config.annotation.web.builders HttpSecurity antMatcher

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.web.builders HttpSecurity antMatcher.

Prototype

public HttpSecurity antMatcher(String antPattern) 

Source Link

Document

Allows configuring the HttpSecurity to only be invoked when matching the provided ant pattern.

Usage

From source file:com.netflix.genie.web.security.saml.SAMLConfig.java

/**
 * Defines the web based security configuration.
 *
 * @param http It allows configuring web based security for specific http requests.
 * @throws Exception on any error/*  w  ww .  j a  v  a2 s  .  co m*/
 */
@Override
protected void configure(final HttpSecurity http) throws Exception {
    // @formatter:off
    http.httpBasic().authenticationEntryPoint(samlEntryPoint());
    http.csrf().disable();
    http.addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class).addFilterAfter(samlFilter(),
            BasicAuthenticationFilter.class);
    http.antMatcher("/**").authorizeRequests().antMatchers("/actuator/**").permitAll().antMatchers("/api/**")
            .permitAll().antMatchers("/error").permitAll().antMatchers("/saml/**").permitAll().anyRequest()
            .authenticated().and().x509().authenticationUserDetailsService(this.x509UserDetailsService);
    http.logout().logoutSuccessUrl("/");
    // @formatter:on
}

From source file:com.netflix.genie.security.saml.SAMLConfig.java

/**
 * Defines the web based security configuration.
 *
 * @param http It allows configuring web based security for specific http requests.
 * @throws Exception on any error/*from ww  w.j av a 2  s . c  o  m*/
 */
@Override
protected void configure(final HttpSecurity http) throws Exception {
    // @formatter:off
    http.httpBasic().authenticationEntryPoint(samlEntryPoint());
    http.csrf().disable();
    http.addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class).addFilterAfter(samlFilter(),
            BasicAuthenticationFilter.class);
    http.antMatcher("/**").authorizeRequests().requestMatchers(EndpointRequest.toAnyEndpoint()).permitAll()
            .antMatchers("/api/**").permitAll().antMatchers("/error").permitAll().antMatchers("/saml/**")
            .permitAll().anyRequest().authenticated().and().x509()
            .authenticationUserDetailsService(this.x509UserDetailsService);
    http.logout().logoutSuccessUrl("/");
    // @formatter:on
}