Example usage for org.springframework.security.authentication ProviderManager ProviderManager

List of usage examples for org.springframework.security.authentication ProviderManager ProviderManager

Introduction

In this page you can find the example usage for org.springframework.security.authentication ProviderManager ProviderManager.

Prototype

public ProviderManager(List<AuthenticationProvider> providers) 

Source Link

Usage

From source file:de.hska.ld.core.config.security.openidconnect.OIDCSecurityConfig.java

@Override
public AuthenticationManager authenticationManager() throws Exception {
    List<AuthenticationProvider> authenticationProviderList = new ArrayList<>();
    OIDCAuthenticationProvider provider = authenticationProvider();
    authenticationProviderList.add(provider);
    authenticationProviderList.add(formAuthenticationProvider());
    authenticationManager = new ProviderManager(authenticationProviderList);
    return authenticationManager;
}

From source file:org.springframework.cloud.dataflow.server.config.security.OAuthSecurityConfiguration.java

@Bean
public ProviderManager providerManager() {
    List<AuthenticationProvider> providers = new ArrayList<>();
    providers.add(this.authenticationProvider());
    ProviderManager providerManager = new ProviderManager(providers);
    return providerManager;
}

From source file:piecework.config.WebSecurityConfiguration.java

@Bean(name = "org.springframework.security.authenticationManager")
public AuthenticationManager authenticationManager() throws Exception {
    switch (authenticationType()) {
    case NONE://from   ww w  . j  a  va 2  s.  co m
    case PREAUTH:
        List<AuthenticationProvider> providers = new ArrayList<AuthenticationProvider>();
        AuthorityMappingPreAuthenticatedProvider authorityMappingPreAuthenticatedProvider = new AuthorityMappingPreAuthenticatedProvider();
        authorityMappingPreAuthenticatedProvider.setAuthoritiesMapper(authorizationRoleMapper);
        authorityMappingPreAuthenticatedProvider.setPreAuthenticatedUserDetailsService(
                new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(userDetailsService));

        providers.add(authorityMappingPreAuthenticatedProvider);

        AuthorityMappingAnonymousAuthenticationProvider authorityMappingAnonymousAuthenticationProvider = new AuthorityMappingAnonymousAuthenticationProvider();
        authorityMappingAnonymousAuthenticationProvider.setAuthoritiesMapper(authorizationRoleMapper);

        providers.add(authorityMappingAnonymousAuthenticationProvider);

        return new ProviderManager(providers);
    }

    return new ProviderManager(Arrays.asList(authenticationProviders));
}