本文整理汇总了Java中org.springframework.security.authentication.dao.DaoAuthenticationProvider类的典型用法代码示例。如果您正苦于以下问题:Java DaoAuthenticationProvider类的具体用法?Java DaoAuthenticationProvider怎么用?Java DaoAuthenticationProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DaoAuthenticationProvider类属于org.springframework.security.authentication.dao包,在下文中一共展示了DaoAuthenticationProvider类的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;
}
示例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);
}
示例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");
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例13: configureGlobal
import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //导入依赖的package包/类
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// Uso un PostProcessor per chiamare setHideUserNotFoundExceptions
auth.userDetailsService(userDetailsService).addObjectPostProcessor(new ObjectPostProcessor<DaoAuthenticationProvider>() {
@Override
public DaoAuthenticationProvider postProcess(DaoAuthenticationProvider processor) {
processor.setHideUserNotFoundExceptions(false); // Permette alla UsernameNotFoundException di arrivare al FailureHandler
if (yadaConfiguration.encodePassword()) {
processor.setPasswordEncoder(passwordEncoder(yadaConfiguration));
}
return processor;
}
});
}
示例14: 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);
}
示例15: daoAuthenticationProvider
import org.springframework.security.authentication.dao.DaoAuthenticationProvider; //导入依赖的package包/类
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider() {
final OneTimePasswordAuthenticationProvider provider = new OneTimePasswordAuthenticationProvider();
provider.setUserDetailsService(userDetailsService());
provider.setPasswordEncoder(passwordEncoder());
return provider;
}