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.fitbit.FitbitOAuthExample.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/**").authorizeRequests().antMatchers("/", "/login**", "/webjars/**").permitAll()
            .anyRequest().authenticated();
}

From source file:com.himanshu.poc.springbootsec.security.SecurityConfigurer.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/secure/**").authorizeRequests().anyRequest().authenticated().and().httpBasic();
}

From source file:shiver.me.timbers.spring.security.integration.SpringSecurityConfiguration.java

@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/normal/**");
    http.csrf().disable();/*from  w ww  . j  a  v a 2 s  . c o  m*/
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/normal/signIn")
            .permitAll();
    http.logout().logoutUrl("/normal/signOut")
            .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}

From source file:shiver.me.timbers.spring.security.integration.AllAnnotationAuthenticationConfiguration.java

@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/all/**");
    http.csrf().disable();// www . j  ava  2 s .co  m
    http.authorizeRequests().antMatchers("/all/one").access("hasRole('ONE')").antMatchers("/all/two")
            .access("hasRole('TWO')").anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/all/signIn")
            .permitAll();
    http.logout().logoutUrl("/all/signOut").logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}

From source file:shiver.me.timbers.spring.security.integration.StormpathAuthenticationConfiguration.java

@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/stormpath/**");
    http.csrf().disable();//w w w  .j  a v  a2s. c  om
    http.authorizeRequests().antMatchers("/stormpath/one").access("hasRole('ONE')")
            .antMatchers("/stormpath/two").access("hasRole('TWO')").anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/stormpath/signIn")
            .permitAll();
    http.logout().logoutUrl("/stormpath/signOut")
            .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}

From source file:shiver.me.timbers.spring.security.integration.JwtCustomPrincipleSecurityConfigurationAnnotation.java

@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/custom/**");
    http.csrf().disable();/*from w  w  w.  java 2 s.c  o  m*/
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/custom/signIn")
            .permitAll();
    http.logout().logoutUrl("/custom/signOut")
            .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}

From source file:org.openbaton.nfvo.security.authentication.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/**").httpBasic().and().authorizeRequests()
            .antMatchers(HttpMethod.OPTIONS, "/oauth/token", "/register").permitAll();
}

From source file:com.himanshu.poc.h2.springboot.SecurityConfigurer.java

protected void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/secure/**").authorizeRequests().anyRequest().authenticated().and().httpBasic();
}

From source file:ch.thp.proto.spring.time.web.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/hello/secure/**").authorizeRequests().antMatchers("/hello/secure/**").hasRole("USER")
            .and().antMatcher("/secure/**").authorizeRequests().antMatchers("/secure/**").hasRole("USER").and()
            .httpBasic().and()//  ww w .jav  a2 s .  co  m
            .addFilterBefore(new BasicAuthenticationFilter(authenticationManager(), new BasicJsonEntryPoint()),
                    BasicAuthenticationFilter.class)
            //todo: check the csrf capability with angularjs
            .csrf().disable();
}

From source file:shiver.me.timbers.spring.security.integration.AllApplyAuthenticationConfiguration.java

@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.apply(jwt());/*w w  w  .  j  a va 2 s  .  co m*/
    http.antMatcher("/all/**");
    http.csrf().disable();
    http.authorizeRequests().antMatchers("/all/one").access("hasRole('ONE')").antMatchers("/all/two")
            .access("hasRole('TWO')").anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/all/signIn")
            .permitAll();
    http.logout().logoutUrl("/all/signOut").logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}