List of usage examples for org.springframework.security.config.annotation.web.builders HttpSecurity authorizeRequests
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests() throws Exception
From source file:cz.muni.pa165.carparkapp.configuration.MySecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/road.jpg", "/style.css").permitAll(); http.logout().logoutUrl("/logout").logoutSuccessUrl("/login?logout=true").permitAll(); http.csrf().disable();//ww w . j av a 2s . c o m http.authorizeRequests().antMatchers("/admin/**").hasRole("ADMIN") // #6 .anyRequest().authenticated().and().formLogin().loginPage("/login") .successHandler(new AuthenticationHandler()).failureUrl("/login?auth=fail").permitAll(); http.exceptionHandling().accessDeniedPage("/403"); }
From source file:com.github.sshw.config.SecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/static/**").permitAll().anyRequest().authenticated().and() .formLogin().loginPage("/login").permitAll().and().logout().logoutUrl("/logout").permitAll(); }
From source file:com.github.wnameless.spring.bulkapi.test.WebSecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable();//ww w .j a v a 2 s . co m http.authorizeRequests().antMatchers("/home").hasRole("USER").and().httpBasic(); http.authorizeRequests().antMatchers(bulkPath).permitAll(); }
From source file:sample.web.WebSecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/", "/cart/**", "/category/**", "/product/**", "/item/**", "/search/**", "/account/add", "/images/**", "/css/**", "/js/**", "/webjars/**") .permitAll().anyRequest().authenticated(); http.formLogin().loginPage("/signin").permitAll().and().logout().logoutUrl("/signout").permitAll(); http.rememberMe().tokenRepository(persistentTokenRepository()); }
From source file:jp.pigumer.app.WebSecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/").permitAll().anyRequest().authenticated(); http.addFilterAfter(authenticationFilter(), BasicAuthenticationFilter.class); http.csrf().disable();/*from w ww . j av a 2 s. c o m*/ }
From source file:nl.capgemini.corpapp.config.OAuth2ResourceServerConfiguration.java
@Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http.authorizeRequests().expressionHandler(new OAuth2WebSecurityExpressionHandler()) .antMatchers("/rest/user/register").anonymous().antMatchers("/rest/**") .access("#oauth2.clientHasRole('ROLE_CLIENT') or hasRole('ROLE_USER')").and().requestMatchers() .antMatchers("/rest/**"); // @formatter:on }
From source file:runtheshow.resource.config.SecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.authorizeRequests().antMatchers("/user/add").permitAll().antMatchers("/user/update", "/user/current") .authenticated().antMatchers("/user/**").hasAnyRole("ADMIN").antMatchers("/event/**") .authenticated().antMatchers("/sousEvent/**").authenticated().antMatchers("/lieu/**") .authenticated().anyRequest().permitAll(); }
From source file:au.edu.anu.orcid.security.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().permitAll().and().formLogin().permitAll().loginPage("/login") .successHandler(new OrcidAuthenticationSuccessHandler()).and().logout().logoutSuccessUrl("/").and() .httpBasic();/*w ww . ja va 2 s.co m*/ }
From source file:sequrity.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/faces/javax.faces.resource/**").permitAll().anyRequest() .authenticated().and().formLogin().loginPage("/faces/prijava.xhtml").permitAll() .failureUrl("/faces/prijava.xhtml?error").loginProcessingUrl("/perform_login") .successHandler(new AuthenticationSuccessHandler() { @Override//from w w w . j av a 2 s .c o m public void onAuthenticationSuccess(HttpServletRequest hsr, HttpServletResponse hsr1, Authentication a) throws IOException, ServletException { RedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); if (a.getAuthorities().contains(new SimpleGrantedAuthority(LoginService.ROLE_PROFESOR))) { redirectStrategy.sendRedirect(hsr, hsr1, "/faces/schedule_profesor.xhtml"); } else { redirectStrategy.sendRedirect(hsr, hsr1, "/faces/schedule.xhtml"); } } }) // .defaultSuccessUrl("/faces/schedule.xhtml", true) .usernameParameter("username").passwordParameter("password").and().logout() .logoutSuccessUrl("/faces/prijava.xhtml"); }
From source file:shiver.me.timbers.security.web.advanced.SecurityConfiguration.java
@Override protected void configureFurther(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().authenticated(); http.formLogin().loginPage("/spring/signIn").permitAll(); http.logout().logoutUrl("/spring/signOut").logoutSuccessUrl("/spring/"); }