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

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

Introduction

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

Prototype

public HttpSecurity authenticationProvider(AuthenticationProvider authenticationProvider) 

Source Link

Usage

From source file:com.javaeeeee.configuration.RestSecurityConfiguration.java

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

From source file:at.plechinger.demo.scribesec.facebook.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authenticationProvider(authenticationProvider).addFilterAfter(authFilter, LogoutFilter.class);
}

From source file:com.wiiyaya.consumer.web.initializer.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authenticationProvider(daoAuthenticationProvider());

    configHeaders(http);//w  ww  . j a v a2 s . c o  m

    configCsrf(http);

    configBackendFormLogin(http);

    configResourceAuthority(http);

    configSessionManager(http);
}

From source file:org.italiangrid.storm.webdav.spring.web.SecurityConfig.java

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

    final List<GrantedAuthority> anonymousAccessPermissions = new ArrayList<GrantedAuthority>();

    for (StorageAreaInfo sa : saConfiguration.getStorageAreaInfo()) {

        if (sa.anonymousReadEnabled()) {

            anonymousAccessPermissions.add(SAPermission.canRead(sa.name()));
        }//  w w w.  j a  v a 2  s  . c o m
    }

    VOMSAuthenticationProvider prov = new VOMSAuthenticationProvider();

    http.csrf().disable();

    http.authenticationProvider(prov).addFilter(buildVOMSAuthenticationFilter(prov));

    if (!anonymousAccessPermissions.isEmpty()) {
        http.anonymous().authorities(anonymousAccessPermissions);
    }

    if (serviceConfiguration.isAuthorizationDisabled()) {

        http.authorizeRequests().anyRequest().permitAll();

    } else {

        http.authorizeRequests().accessDecisionManager(accessDecisionManager());
        addAccessRules(http);

    }
}

From source file:org.flowable.rest.conf.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    HttpSecurity httpSecurity = http.authenticationProvider(authenticationProvider()).sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().csrf().disable();

    // Swagger docs
    if (isSwaggerDocsEnabled()) {
        httpSecurity.authorizeRequests().antMatchers("/docs/**").permitAll();

    } else {//  w ww.  jav a2s.  co  m
        httpSecurity.authorizeRequests().antMatchers("/docs/**").denyAll();

    }

    httpSecurity.authorizeRequests()
            .requestMatchers(EndpointRequest.to(InfoEndpoint.class, HealthEndpoint.class)).authenticated()
            .requestMatchers(EndpointRequest.toAnyEndpoint()).hasAnyAuthority(SecurityConstants.ACCESS_ADMIN);

    // Rest API access
    if (isVerifyRestApiPrivilege()) {
        httpSecurity.authorizeRequests().anyRequest().hasAuthority(SecurityConstants.PRIVILEGE_ACCESS_REST_API)
                .and().httpBasic();

    } else {
        httpSecurity.authorizeRequests().anyRequest().authenticated().and().httpBasic();

    }
}