org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper Java Examples

The following examples show how to use org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper. 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 File: AuthorizationServerConfig.java    From oauth-server with 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 File: InceptionSecurity.java    From inception with 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 File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #4
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #5
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #6
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #7
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #8
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(
        final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #9
Source File: WebAnnoSecurity.java    From webanno with 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 #10
Source File: CasSsoContextConfig.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(CasAuthenticationProvider.class)
public CasAuthenticationProvider casAuthenticationProvider(){
	CasAuthenticationProvider casProvider = new CasAuthenticationProvider();
	casProvider.setAuthenticationUserDetailsService(new UserDetailsByNameServiceWrapper<>(userDetailsService));
	casProvider.setServiceProperties(serviceProperties());
	casProvider.setTicketValidator(new Cas20ServiceTicketValidator(bootSecurityConfig.getCas().getCasServerUrl()));
	casProvider.setKey(bootSecurityConfig.getCas().getKey());
	return casProvider;
}
 
Example #11
Source File: SecurityConfig.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> userDetailsServiceWrapper() throws Exception {
    UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> wrapper = new UserDetailsByNameServiceWrapper<>();
    wrapper.setUserDetailsService(userDetailsService());
    return wrapper;
}
 
Example #12
Source File: WebSecurityConfig.java    From dubbo-postman with MIT License 4 votes vote down vote up
/**
 * 当CAS认证成功时, Spring Security会自动调用此类对用户进行授权
 */
private UserDetailsByNameServiceWrapper userDetailsByNameServiceWrapper() {
    UserDetailsByNameServiceWrapper wrapper = new UserDetailsByNameServiceWrapper();
    wrapper.setUserDetailsService(userDetailsService);
    return wrapper;
}
 
Example #13
Source File: SecurityConfig.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> userDetailsServiceWrapper() throws Exception {
    UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> wrapper = new UserDetailsByNameServiceWrapper<>();
    wrapper.setUserDetailsService(userDetailsService());
    return wrapper;
}
 
Example #14
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #15
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #16
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #17
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #18
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsByNameServiceWrapper authenticationUserDetailsService(final UserDetailsService userDetailsService){
    return new UserDetailsByNameServiceWrapper(){{
        setUserDetailsService(userDetailsService);
    }};
}
 
Example #19
Source File: TokenConfig.java    From mall4j with 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)));
}