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:com.jayway.restassured.examples.springmvc.config.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().permitAll().antMatchers("/secured/**").hasRole(ROLE_USER).and()
            .httpBasic();//from  w  ww  .  j av a 2  s  .com
}

From source file:org.karthikps.controller.LoginConfig.java

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

From source file:com.pw.ism.TestSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers(HttpMethod.POST, "/newmessage", "/addheartbeat").permitAll()
            .antMatchers("/", "/css/**", "/js/**", "/images/**").permitAll().anyRequest().authenticated().and()
            .csrf().ignoringAntMatchers("/newmessage", "/addheartbeat").and().formLogin().loginPage("/login")
            .permitAll().and().logout().permitAll();
}

From source file:io.getlime.push.configuration.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().anonymous();
    http.httpBasic().disable();/*from   w w w  .  j  av a2  s  .co  m*/
    http.csrf().disable();
}

From source file:com.example.okta.ResourceServer.java

@Override
protected void authorizeRequests(final HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers(HttpMethod.GET, securedRoute).hasAnyAuthority(accessScope).anyRequest()
            .authenticated();/*from w  w w . ja  v a  2  s  . c  om*/
}

From source file:it.f2informatica.webapp.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers(HttpMethod.GET, "/login*").permitAll()
            .antMatchers(HttpMethod.GET, "/static/**").access("isAnonymous() or isAuthenticated()")
            .antMatchers(HttpMethod.GET, "/**").authenticated();

    http.formLogin().loginPage("/login").loginProcessingUrl("/processLogin").usernameParameter("username")
            .passwordParameter("password").defaultSuccessUrl("/home", true).failureUrl("/login_failed");
}

From source file:nl.xillio.gitbreakers.procrastimaster.server.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().authenticated().and().csrf().disable().cors().disable().httpBasic();
}

From source file:com.examplee.SecurityConfig.java

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

    http.authorizeRequests().antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')").and().formLogin()
            .loginPage("/login").failureUrl("/login?error").usernameParameter("username")
            .passwordParameter("password").and().logout().logoutSuccessUrl("/login?logout").and()
            .exceptionHandling().accessDeniedPage("/info").and().csrf();
}

From source file:org.verinice.rest.security.WebSecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers(unsecuredResources).permitAll();
    http.authorizeRequests().anyRequest().fullyAuthenticated().and().httpBasic().and().csrf().disable();
}

From source file:com.ar.dev.tierra.hasar.api.config.security.WebSecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/**").authenticated();
}