List of usage examples for org.springframework.security.config.annotation.web.builders HttpSecurity authorizeRequests
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests() throws Exception
From source file:com.acme.portal.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); http.authorizeRequests().antMatchers("/info/**").authenticated(); }
From source file:com.restfiddle.config.security.SecurityConfig.java
protected void configure(HttpSecurity http) throws Exception { http.csrf().disable();//from w w w .j a v a 2 s . co m http.authorizeRequests().antMatchers("/api/**", "/about", "/fonts/**").permitAll().anyRequest() .authenticated().and().formLogin().loginPage("/login").failureUrl("/login?error").permitAll(); http.logout().logoutSuccessUrl("/"); }
From source file:cz.muni.fi.editor.webapp.config.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/setup/", "/").permitAll().antMatchers("/auth/**").authenticated() .and().logout().logoutUrl("/auth/logout/").logoutSuccessUrl("/login/").and().formLogin() .loginPage("/login/").loginProcessingUrl("/login").defaultSuccessUrl("/auth/").permitAll().and() .csrf();//w w w .jav a 2s. c o m }
From source file:org.schedoscope.metascope.config.TestSpringConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().permitAll(); http.csrf().disable();/* ww w .j av a 2 s .c o m*/ }
From source file:com.marklogic.samplestack.mock.MockApplicationSecurity.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers(HttpMethod.GET, "/session", "/questions/**", "/tags/**").permitAll() .and().authorizeRequests().antMatchers(HttpMethod.POST, "/search").permitAll().and() .authorizeRequests().antMatchers("/questions/**", "/contributors/**").authenticated().and() .authorizeRequests().anyRequest().denyAll(); http.formLogin().failureHandler(failureHandler).successHandler(successHandler).permitAll().and().logout() .logoutSuccessHandler(logoutSuccessHandler).permitAll(); http.csrf().disable();/* w ww.j a v a 2s. c o m*/ http.exceptionHandling().authenticationEntryPoint(entryPoint) .accessDeniedHandler(samplestackAccessDeniedHandler); }
From source file:bg.elkabel.calculator.configuration.SiteSecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().permitAll().and().csrf().disable();// - disable security; // http // .authorizeRequests() // .antMatchers("/", "/register", "/js/**", "/css/**").permitAll() // .antMatchers("/user/**").access("hasRole('USER') OR hasRole('ADMIN')") // .antMatchers("/admin/**").hasRole("ADMIN") // .anyRequest().authenticated() // .and() // .formLogin().loginPage("/login").permitAll() // .usernameParameter("username") // .passwordParameter("password") // .and() // .logout().logoutSuccessUrl("/login?logout").permitAll() // .and() // .rememberMe() // .rememberMeParameter("remember") // .key("The Wheel of Time") // .rememberMeCookieName("rememberMeCookie") // .tokenValiditySeconds(10000) // .and() // .exceptionHandling().accessDeniedPage("/unauthorized") // .and() // .csrf().disable(); }
From source file:com.jeanchampemont.notedown.config.WebSecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/app/**").authenticated().and().formLogin().loginPage("/login") .failureUrl("/login?error").usernameParameter("email").passwordParameter("password") .defaultSuccessUrl("/app").and().logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET")).logoutSuccessUrl("/login?logout") .and().rememberMe().tokenRepository(persistentTokenRepository()) .tokenValiditySeconds(tokenValiditySeconds).and().csrf(); }
From source file:de.dominikschadow.javasecurity.sessionhandling.config.WebSecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.authorizeRequests().antMatchers("/*").permitAll().antMatchers("/user/**").hasAnyRole("USER", "ADMIN") .antMatchers("/admin/**").hasRole("ADMIN").and().formLogin().and().logout().logoutSuccessUrl("/") .permitAll();// www . j av a2 s. co m // @formatter:on }
From source file:org.shaigor.rest.retro.service.security.config.OAuth2SecurityConfigurer.java
@Override public void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/login.jsp").permitAll().and().authorizeRequests().anyRequest() .hasRole("USER").and().exceptionHandling().accessDeniedPage("/login.jsp?authorization_error=true") .and()//from w w w . jav a 2s.co m // TODO: put CSRF protection back into this endpoint .csrf().requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize")).disable() .logout().logoutSuccessUrl("/index.jsp").logoutUrl("/logout.do").and().authorizeRequests() .regexMatchers(HttpMethod.GET, "/word/list(\\?.*)?") // .access("hasIpAddress('127.0.0.1') or (#oauth2.hasScope('words') and hasRole('ROLE_USER'))") .access("#oauth2.hasScope('words') and hasRole('ROLE_USER')").and().formLogin() .usernameParameter("j_username").passwordParameter("j_password") .failureUrl("/login.jsp?authentication_error=true").loginPage("/login.jsp") .loginProcessingUrl("/j_spring_security_check"); }
From source file:oobbit.security.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { // Oletuksena saa tehd mit haluaa http.authorizeRequests().anyRequest().permitAll(); http.formLogin().loginPage("/login").loginProcessingUrl("/authenticate").defaultSuccessUrl("/me") .usernameParameter("username").passwordParameter("password").permitAll(); http.logout().logoutUrl("/logout").logoutSuccessUrl("/login").permitAll().invalidateHttpSession(true); }