Search in sources :

Example 1 with PreAuthenticatedAuthenticationProvider

use of org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider in project spring-security by spring-projects.

the class JeeConfigurer method init.

/**
 * Populates a {@link PreAuthenticatedAuthenticationProvider} into
 * {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
 * and a {@link Http403ForbiddenEntryPoint} into
 * {@link HttpSecurityBuilder#setSharedObject(Class, Object)}
 *
 * @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
 */
@Override
public void init(H http) {
    PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
    authenticationProvider.setPreAuthenticatedUserDetailsService(getUserDetailsService());
    authenticationProvider = postProcess(authenticationProvider);
    http.authenticationProvider(authenticationProvider).setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
Also used : PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) Http403ForbiddenEntryPoint(org.springframework.security.web.authentication.Http403ForbiddenEntryPoint)

Example 2 with PreAuthenticatedAuthenticationProvider

use of org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider in project spring-security-oauth by spring-projects.

the class AuthorizationServerEndpointsConfigurer method addUserDetailsService.

private void addUserDetailsService(DefaultTokenServices tokenServices, UserDetailsService userDetailsService) {
    if (userDetailsService != null) {
        PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
        provider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(userDetailsService));
        tokenServices.setAuthenticationManager(new ProviderManager(Arrays.<AuthenticationProvider>asList(provider)));
    }
}
Also used : PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) ProviderManager(org.springframework.security.authentication.ProviderManager) AuthenticationProvider(org.springframework.security.authentication.AuthenticationProvider) PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) PreAuthenticatedAuthenticationToken(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken)

Example 3 with PreAuthenticatedAuthenticationProvider

use of org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider in project herd by FINRAOS.

the class AppSpringModuleConfig method authenticationManager.

@Bean
@Override
public AuthenticationManager authenticationManager() {
    PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
    authenticationProvider.setPreAuthenticatedUserDetailsService(herdUserDetailsService);
    List<AuthenticationProvider> providers = new ArrayList<>();
    providers.add(authenticationProvider);
    return new ProviderManager(providers);
}
Also used : PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) ProviderManager(org.springframework.security.authentication.ProviderManager) AuthenticationProvider(org.springframework.security.authentication.AuthenticationProvider) PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) ArrayList(java.util.ArrayList) Bean(org.springframework.context.annotation.Bean)

Example 4 with PreAuthenticatedAuthenticationProvider

use of org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider in project syndesis by syndesisio.

the class SecurityConfiguration method authenticationProvider.

private AuthenticationProvider authenticationProvider() {
    PreAuthenticatedAuthenticationProvider authProvider = new PreAuthenticatedAuthenticationProvider();
    authProvider.setPreAuthenticatedUserDetailsService(new PreAuthenticatedGrantedAuthoritiesUserDetailsService());
    return authProvider;
}
Also used : PreAuthenticatedGrantedAuthoritiesUserDetailsService(org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesUserDetailsService) PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider)

Example 5 with PreAuthenticatedAuthenticationProvider

use of org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider in project spring-security by spring-projects.

the class X509Configurer method init.

@Override
public void init(H http) {
    PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
    authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
    http.authenticationProvider(authenticationProvider).setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
Also used : PreAuthenticatedAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) Http403ForbiddenEntryPoint(org.springframework.security.web.authentication.Http403ForbiddenEntryPoint)

Aggregations

PreAuthenticatedAuthenticationProvider (org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider)5 AuthenticationProvider (org.springframework.security.authentication.AuthenticationProvider)2 ProviderManager (org.springframework.security.authentication.ProviderManager)2 Http403ForbiddenEntryPoint (org.springframework.security.web.authentication.Http403ForbiddenEntryPoint)2 ArrayList (java.util.ArrayList)1 Bean (org.springframework.context.annotation.Bean)1 PreAuthenticatedAuthenticationToken (org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken)1 PreAuthenticatedGrantedAuthoritiesUserDetailsService (org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesUserDetailsService)1