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

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

Introduction

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

Prototype

public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests()
        throws Exception 

Source Link

Document

Allows restricting access based upon the HttpServletRequest using <h2>Example Configurations</h2> The most basic example is to configure all URLs to require the role "ROLE_USER".

Usage

From source file:org.starfishrespect.myconsumption.server.business.security.WebSecurityConfig.java

/**
 * Define the security policy for the REST services.
 * BASIC authentication is supported.//from   ww w  .  ja v  a 2  s. c om
 */
@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers(HttpMethod.POST, "/users/**").permitAll() // needed to create a user on the first launch of the app
            .antMatchers(HttpMethod.POST, "/users/**/sensor/**").authenticated().antMatchers("/configs/**")
            .permitAll() // this resource does not need to be protected
            .anyRequest().authenticated().and().httpBasic().and().csrf().disable().sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}

From source file:com.mycompany.startup.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/css/**", "/home", "/", "/club/**", "/leagues/**").permitAll()
            .anyRequest().authenticated().and().formLogin().loginPage("/login").permitAll().and().formLogin()
            .successForwardUrl("/loginSuccess").permitAll().and().logout().permitAll();
}

From source file:ua.com.rocketlv.spb.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/").permitAll().anyRequest().authenticated();
    http.formLogin().loginPage("/login").permitAll().and().logout().permitAll();

}

From source file:com.hendisantika.ldap.WebSecurityConfig.java

protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/", "/home").permitAll().anyRequest().authenticated().and()
            .formLogin()//from   w w  w .  java2s. c om
            //                .loginPage("/login")
            .loginPage("/ldap").permitAll().and().logout().permitAll();

}

From source file:com.github.viktornar.configuration.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().permitAll().and().exceptionHandling().accessDeniedPage("/403").and()
            .csrf();//from w w  w  . j a v  a2 s  .c om
}

From source file:com.orange.clara.pivotaltrackermirror.config.SecurityConfig.java

@Override
public void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/swagger/**").permitAll().antMatchers("/assets/**").permitAll()
            .anyRequest().authenticated().and().httpBasic().and().csrf().ignoringAntMatchers("/api/**");
}

From source file:com.ueag.auth.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/resources/**", "/registration").permitAll().anyRequest()
            .authenticated().and().formLogin().loginPage("/login").permitAll().and().logout().permitAll();
}

From source file:com.greglturnquist.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().authenticated().and().formLogin().permitAll();
}

From source file:com.jelastic.campitos.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()

            .anyRequest().authenticated().and().formLogin().loginPage("/servicios/login").permitAll().and()
            .logout().permitAll().deleteCookies("JSESSIONID").and().sessionManagement()
            .sessionAuthenticationErrorUrl("/servicios/caducada");
}

From source file:coral.reef.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/admin/**").authenticated().antMatchers("/actuator/**")
            .authenticated().anyRequest().permitAll().and().httpBasic();
    http.csrf().disable();/* ww w .j  av a 2s.co m*/
}