@Override public void init(H http) throws Exception { super.init(http); initDefaultLoginFilter(http); }
public static void permitAll( HttpSecurityBuilder<? extends HttpSecurityBuilder<?>> http, String... urls) { for (String url : urls) { if (url != null) { permitAll(http, new ExactUrlRequestMatcher(url)); } } }
@Override public void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/" , "/demo").permitAll() .anyRequest().authenticated(); } }
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http .authorizeRequests() .antMatchers("/actuator/**").permitAll() .anyRequest().authenticated() .and() .httpBasic() ; } }
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers("/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll() .antMatchers("/**").hasAnyRole(USER_ROLE); http.formLogin().loginPage("/signin").permitAll().failureUrl("/signin?#/error").and().httpBasic(); SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); urlLogoutHandler.setDefaultTargetUrl("/signin?#/logout"); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessHandler(urlLogoutHandler); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .authorizeRequests().anyRequest().authenticated() .and() .csrf().disable(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated() .and() .httpBasic() .realmName("RealmConfig"); } }
@Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().anonymous() .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.NEVER); } }
@Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().hasRole("USER") .and() .httpBasic() .authenticationEntryPoint(this.authenticationEntryPoint); } }
@Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().hasRole("USER") .and() .httpBasic().realmName("Custom Realm"); } }
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); } }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .authorizeRequests() .anyRequest().denyAll(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .authorizeRequests() .mvcMatchers("/path").servletPath("/spring").denyAll(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .authorizeRequests() .mvcMatchers("/path").denyAll(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .authorizeRequests() .mvcMatchers("/user/{userName}").access("#userName == 'user'"); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .apply(new UrlAuthorizationConfigurer(getApplicationContext())).getRegistry() .mvcMatchers("/path").servletPath("/spring").hasRole("ADMIN"); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .httpBasic().and() .apply(new UrlAuthorizationConfigurer(getApplicationContext())).getRegistry() .mvcMatchers("/path").hasRole("ADMIN"); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { http .requiresChannel() .anyRequest().requiresSecure() .and() .portMapper() .http(543).mapsTo(123) .and() .portMapper(); } }
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers("/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll() .antMatchers("/**").authenticated(); http.formLogin().loginPage("/signin").permitAll().failureUrl("/signin?#/error").and().httpBasic(); SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); urlLogoutHandler.setDefaultTargetUrl("/signin?#/logout"); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessHandler(urlLogoutHandler); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); }
@Override protected void configure(HttpSecurity http) throws Exception { http.httpBasic(); http.csrf().disable(); http.headers().frameOptions().sameOrigin(); }