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

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

Introduction

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

Prototype

public HttpSecurity addFilter(Filter filter) 

Source Link

Usage

From source file:br.com.hyperclass.snackbar.config.SecurityConfiguration.java

@Override
public void configure(final HttpSecurity http) throws Exception {
    http.addFilter(preAuthenticationFilter());
    http.addFilter(loginFilter());//from  w w w .ja va2s.co  m
    http.addFilter(anonymousFilter());
    http.csrf().disable();
    http.authorizeRequests().antMatchers("/menu/**").hasRole("ADMIN").antMatchers("/stock/**").hasRole("ADMIN")
            .antMatchers("/order/**").permitAll().antMatchers("/cashier/**").authenticated().and().formLogin();
}

From source file:com.hp.autonomy.frontend.find.idol.beanconfiguration.ReverseProxyIdolSecurityCustomizer.java

@SuppressWarnings("ProhibitedExceptionDeclared")
@Override/*  w ww  .  j  a v  a 2  s .c om*/
public void customize(final HttpSecurity http, final AuthenticationManager authenticationManager)
        throws Exception {
    final J2eePreAuthenticatedProcessingFilter filter = new J2eePreAuthenticatedProcessingFilter();
    filter.setAuthenticationManager(authenticationManager);

    http.addFilter(filter);
}

From source file:org.devgateway.toolkit.web.spring.WebSecurityConfig.java

@Override
protected void configure(final HttpSecurity http) throws Exception {
    http.authorizeRequests().expressionHandler(webExpressionHandler()) // inject role hierarchy
            .anyRequest().authenticated().and().formLogin().loginPage("/login").permitAll().and().requestCache()
            .and().logout().permitAll().and().sessionManagement().and().csrf().disable();
    http.addFilter(securityContextPersistenceFilter());
}

From source file:de.thm.arsnova.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint());
    http.csrf().disable();//ww w. j a  v  a  2  s . c om

    if (casEnabled) {
        http.addFilter(casAuthenticationFilter());
        http.addFilter(casLogoutFilter());
    }
    if (googleEnabled) {
        http.addFilterAfter(googleFilter(), CasAuthenticationFilter.class);
    }
    if (facebookEnabled) {
        http.addFilterAfter(facebookFilter(), CasAuthenticationFilter.class);
    }
    if (twitterEnabled) {
        http.addFilterAfter(twitterFilter(), CasAuthenticationFilter.class);
    }
}

From source file:org.ambraproject.wombat.config.SpringSecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    if (runtimeConfiguration.getCasConfiguration().isPresent()) {
        http.addFilter(casAuthenticationFilter()).addFilterBefore(requestLogoutFilter(), LogoutFilter.class)
                .addFilterBefore(singleSignOutFilter(), CasAuthenticationFilter.class).authorizeRequests()
                .antMatchers(USER_AUTH_INTERCEPT_PATTERN).fullyAuthenticated().and().authorizeRequests()
                .requestMatchers(new RequestMatcher() {
                    public boolean matches(HttpServletRequest request) {
                        String path = "" + request.getServletPath() + request.getPathInfo();
                        String host = "" + request.getServerName().toLowerCase();
                        return (path != null
                                && (path.contains("DesktopApertaRxiv") || host.contains("apertarxiv")));
                    }/*w w  w  .j a  v  a  2 s  .  c o m*/
                }).permitAll().and().authorizeRequests().antMatchers(NEW_COMMENT_AUTH_INTERCEPT_PATTERN)
                .fullyAuthenticated().and().authorizeRequests().antMatchers(FLAG_COMMENT_AUTH_INTERCEPT_PATTERN)
                .fullyAuthenticated();

        http.exceptionHandling().authenticationEntryPoint(casAuthenticationEntryPoint());
        http.csrf().disable();
    }
}