當前位置: 首頁>>代碼示例>>Java>>正文


Java DaoAuthenticationProvider.setUserDetailsService方法代碼示例

本文整理匯總了Java中org.springframework.security.authentication.dao.DaoAuthenticationProvider.setUserDetailsService方法的典型用法代碼示例。如果您正苦於以下問題:Java DaoAuthenticationProvider.setUserDetailsService方法的具體用法?Java DaoAuthenticationProvider.setUserDetailsService怎麽用?Java DaoAuthenticationProvider.setUserDetailsService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.security.authentication.dao.DaoAuthenticationProvider的用法示例。


在下文中一共展示了DaoAuthenticationProvider.setUserDetailsService方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clientAuthenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean(name = "clientAuthenticationProvider")
public AuthenticationProvider clientAuthenticationProvider() {
	DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
	provider.setPasswordEncoder(new BCryptPasswordEncoder());
	provider.setUserDetailsService(new ClientDetailsUserDetailsService(clientAuthenticationService));
	return provider;
}
 
開發者ID:PatternFM,項目名稱:tokamak,代碼行數:8,代碼來源:AuthorizationServerConfiguration.java

示例2: configure

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
    authenticationProvider.setUserDetailsService(detailsService);
    authenticationProvider.setPasswordEncoder(new PlaintextPasswordEncoder() {
        @Override
        public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
            try {
                return new PasswordManager().validatePassword(rawPass, encPass);
            } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
                LOGGER.error(e.getMessage(), e);
                return false;
            }
        }
    });
    auth.authenticationProvider(authenticationProvider);
}
 
開發者ID:KonkerLabs,項目名稱:konker-platform,代碼行數:18,代碼來源:SecurityConfig.java

示例3: configure

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
	CustomJdbcUserDetailsService customJdbcUserDetailsService = new CustomJdbcUserDetailsService();
	customJdbcUserDetailsService.setDataSource(dataSource);

	DaoAuthenticationProvider customJdbcProvider = new DaoAuthenticationProvider();
	customJdbcProvider.setUserDetailsService(customJdbcUserDetailsService);

	CustomLdapAuthoritiesPopulator customLdapAuthoritiesPopulator = new CustomLdapAuthoritiesPopulator(customJdbcUserDetailsService);

	auth.jdbcAuthentication().dataSource(dataSource);
	auth.inMemoryAuthentication().withUser("memdemo").password("secret").roles("USER").and().withUser("memadmin").password("53cr37").roles("ADMIN");
	auth.authenticationProvider(customJdbcProvider);
	auth.ldapAuthentication().userDnPatterns("uid={0},ou=users").groupSearchBase("ou=groups").groupRoleAttribute("ou").contextSource()
			.ldif("classpath:com/iampfac/howto/spring/security/users.ldif").root("dc=example,dc=org");

	auth.ldapAuthentication().ldapAuthoritiesPopulator(customLdapAuthoritiesPopulator).userDnPatterns("uid={0},ou=users").contextSource()
			.ldif("classpath:com/iampfac/howto/spring/security/mix.ldif").root("dc=example,dc=org");
}
 
開發者ID:pfac,項目名稱:demo-spring-security,代碼行數:20,代碼來源:SecurityConfiguration.java

示例4: configure

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Override
protected void configure(AuthenticationManagerBuilder auth)
{
	try
	{
		DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
		authenticationProvider.setPasswordEncoder(passwordEncoder());
		authenticationProvider.setUserDetailsService(userDetailsServiceBean());
		authenticationProvider.setPreAuthenticationChecks(userDetailsChecker());
		auth.authenticationProvider(authenticationProvider);
	}
	catch (Exception e)
	{
		throw new RuntimeException(e);
	}
}
 
開發者ID:molgenis,項目名稱:molgenis,代碼行數:17,代碼來源:MolgenisWebAppSecurityConfig.java

示例5: daoAuthenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider(UserDetailsService userDetailsService,
    PasswordEncoder passwordEncoder) {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setUserDetailsService(userDetailsService);
    provider.setPasswordEncoder(passwordEncoder);
    return provider;
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:9,代碼來源:UaaConfiguration.java

示例6: authProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public DaoAuthenticationProvider authProvider() {
 DaoAuthenticationProvider daoProvider = new DaoAuthenticationProvider();
	daoProvider.setPasswordEncoder(md5PasswordEncoder());
	daoProvider.setUserDetailsService(userDetailsService);
	ReflectionSaltSource saltHash = new ReflectionSaltSource();
	saltHash.setUserPropertyToUse("username");
	daoProvider.setSaltSource(saltHash);
    return daoProvider;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:11,代碼來源:AppSecurityModelG.java

示例7: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
DaoAuthenticationProvider authenticationProvider() {
	DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
	authProvider.setUserDetailsService(userDetailsService);
	authProvider.setPasswordEncoder(passwordEncoder());
	return authProvider;
}
 
開發者ID:Azanx,項目名稱:Smart-Shopping,代碼行數:8,代碼來源:WebSecurityConfig.java

示例8: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
DaoAuthenticationProvider authenticationProvider() {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setUserDetailsService(userDetailsService);
    provider.setPasswordEncoder(passwordEncoder());
    return provider;
}
 
開發者ID:BakkerTom,項目名稱:happy-news,代碼行數:8,代碼來源:WebSecurityConfig.java

示例9: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public AuthenticationProvider authenticationProvider(UserRepository repository) {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setUserDetailsService(userDetailsService(repository));
    provider.setPasswordEncoder(passwordEncoder());
    return provider;
}
 
開發者ID:AlexIvchenko,項目名稱:markdown-redactor,代碼行數:8,代碼來源:RootSecurityConfig.java

示例10: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public DaoAuthenticationProvider authenticationProvider() {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setPasswordEncoder( passwordEncoder );
    provider.setUserDetailsService( userDetailsService() );
    return provider;
}
 
開發者ID:tinmegali,項目名稱:Using-Spring-Oauth2-to-secure-REST,代碼行數:8,代碼來源:SecurityConfig.java

示例11: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public DaoAuthenticationProvider authenticationProvider() {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setPasswordEncoder( passwordEncoder );
    provider.setUserDetailsService(userDetailsService());
    return provider;
}
 
開發者ID:tinmegali,項目名稱:Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token,代碼行數:8,代碼來源:SecurityConfig.java

示例12: userAuthenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public AuthenticationProvider userAuthenticationProvider() {
	DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
	provider.setPasswordEncoder(new BCryptPasswordEncoder());
	provider.setUserDetailsService(accountAuthenticationService);
	return provider;
}
 
開發者ID:PatternFM,項目名稱:tokamak,代碼行數:8,代碼來源:AuthorizationServerConfiguration.java

示例13: configure

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
	DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
	provider.setUserDetailsService(userService);
	provider.setPasswordEncoder(encryption());
	
	auth.authenticationProvider(provider);
	auth.userDetailsService(userService);
   }
 
開發者ID:francisco-gcd,項目名稱:spring-security-rest,代碼行數:10,代碼來源:SecurityConfiguration.java

示例14: authenticationProvider

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public DaoAuthenticationProvider authenticationProvider() {
    DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
    authProvider.setUserDetailsService(userDetailsService);
    authProvider.setPasswordEncoder(passwordEncoder());
    return authProvider;
}
 
開發者ID:csokafor,項目名稱:spring-security-angularjs,代碼行數:8,代碼來源:SecurityConfig.java

示例15: clientAuthenticationManager

import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //導入方法依賴的package包/類
@Bean
public AuthenticationManager clientAuthenticationManager() {
    DaoAuthenticationProvider clientAuthenticationProvider = new DaoAuthenticationProvider();
    clientAuthenticationProvider.setUserDetailsService(clientDetailsUserDetailsService());
    clientAuthenticationProvider.setHideUserNotFoundExceptions(false);
    return new ProviderManager(Collections.singletonList(clientAuthenticationProvider));
}
 
開發者ID:gravitee-io,項目名稱:graviteeio-access-management,代碼行數:8,代碼來源:AuthorizationServerConfiguration.java


注:本文中的org.springframework.security.authentication.dao.DaoAuthenticationProvider.setUserDetailsService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。