Java Code Examples for org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider

The following examples show how to use org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: oauth-server   Source File: AuthorizationServerConfig.java    License: Apache License 2.0 5 votes vote down vote up
private void addUserDetailsService(CustomTokenService tokenServices, UserDetailsService userDetailsService) {
    if (userDetailsService != null) {
        PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
        provider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper<>(
                userDetailsService));
        tokenServices.setAuthenticationManager(new ProviderManager(Arrays.asList(provider)));
    }
}
 
Example 2
Source Project: inception   Source File: InceptionSecurity.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name = "authenticationProvider")
@Profile("auto-mode-preauth")
public PreAuthenticatedAuthenticationProvider externalAuthenticationProvider()
{
    PreAuthenticatedAuthenticationProvider authProvider = 
            new PreAuthenticatedAuthenticationProvider();
    authProvider.setPreAuthenticatedUserDetailsService(
            new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(
                    userDetailsService()));
    return authProvider;
}
 
Example 3
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
@Bean
    public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(
//            final AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService)
            final AuthenticationUserDetailsService authenticationUserDetailsService)
    {
        return new PreAuthenticatedAuthenticationProvider(){{
            setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
        }};
    }
 
Example 4
Source Project: herd   Source File: AppSpringModuleConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManager()
{
    PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
    authenticationProvider.setPreAuthenticatedUserDetailsService(herdUserDetailsService);
    List<AuthenticationProvider> providers = new ArrayList<>();
    providers.add(authenticationProvider);
    return new ProviderManager(providers);
}
 
Example 5
Source Project: webanno   Source File: WebAnnoSecurity.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name = "authenticationProvider")
@Profile("auto-mode-preauth")
public PreAuthenticatedAuthenticationProvider externalAuthenticationProvider()
{
    PreAuthenticatedAuthenticationProvider authProvider = 
            new PreAuthenticatedAuthenticationProvider();
    authProvider.setPreAuthenticatedUserDetailsService(
            new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(
                    userDetailsService()));
    return authProvider;
}
 
Example 6
Source Project: bearchoke   Source File: SecurityConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name = "preAuthAuthenticationManager")
public AuthenticationManager preAuthAuthenticationManager() {
    PreAuthenticatedAuthenticationProvider preAuthProvider = new PreAuthenticatedAuthenticationProvider();
    preAuthProvider.setPreAuthenticatedUserDetailsService(preAuthUserDetailsService);

    List<AuthenticationProvider> providers = new ArrayList<AuthenticationProvider>();
    providers.add(preAuthProvider);

    return new ProviderManager(providers);
}
 
Example 7
Source Project: bearchoke   Source File: MockServerConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name = "preAuthAuthenticationManager")
public AuthenticationManager preAuthAuthenticationManager() {
    PreAuthenticatedAuthenticationProvider preAuthProvider = new PreAuthenticatedAuthenticationProvider();
    preAuthProvider.setPreAuthenticatedUserDetailsService(preAuthUserDetailsService());

    return new ProviderManager(Arrays.asList(preAuthProvider));
}
 
Example 8
Source Project: mall4j   Source File: TokenConfig.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
private void addUserDetailsService(YamiTokenServices tokenServices) {
    PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
    provider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper<>(userDetailsService));
    tokenServices.setAuthenticationManager(new ProviderManager(Collections.singletonList(provider)));
}
 
Example 9
Source Project: syndesis   Source File: SecurityConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
private static AuthenticationProvider authenticationProvider() {
    PreAuthenticatedAuthenticationProvider authProvider = new PreAuthenticatedAuthenticationProvider();
    authProvider.setPreAuthenticatedUserDetailsService(new PreAuthenticatedGrantedAuthoritiesUserDetailsService());
    return authProvider;
}
 
Example 10
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
    return new PreAuthenticatedAuthenticationProvider(){{
        setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
    }};
}
 
Example 11
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
    return new PreAuthenticatedAuthenticationProvider(){{
        setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
    }};
}
 
Example 12
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
    return new PreAuthenticatedAuthenticationProvider(){{
        setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
    }};
}
 
Example 13
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
    return new PreAuthenticatedAuthenticationProvider(){{
        setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
    }};
}
 
Example 14
Source Project: todolist   Source File: WebSecurityConfiguration.java    License: MIT License 4 votes vote down vote up
@Bean
PreAuthenticatedAuthenticationProvider preAuthenticationProvider() {
	PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
	provider.setPreAuthenticatedUserDetailsService(apiDetailsService());
	return provider;
}
 
Example 15
Source Project: training   Source File: WebSecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public AuthenticationProvider preAuthenticatedProvider() {
    PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
    provider.setPreAuthenticatedUserDetailsService(preauthUserDetailsService());
    return provider;
}
 
Example 16
Source Project: cloudbreak   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthProvider() throws Exception {
    PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
    provider.setPreAuthenticatedUserDetailsService(userDetailsServiceWrapper());
    return provider;
}
 
Example 17
Source Project: cloudbreak   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public PreAuthenticatedAuthenticationProvider preAuthAuthProvider() throws Exception {
    PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
    provider.setPreAuthenticatedUserDetailsService(userDetailsServiceWrapper());
    return provider;
}