本文整理汇总了Java中org.springframework.security.crypto.password.PasswordEncoder类的典型用法代码示例。如果您正苦于以下问题:Java PasswordEncoder类的具体用法?Java PasswordEncoder怎么用?Java PasswordEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PasswordEncoder类属于org.springframework.security.crypto.password包,在下文中一共展示了PasswordEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DefaultCalendarService
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
final CalendarUserDao userDao,
final CalendarUserRepository userRepository,
final PasswordEncoder passwordEncoder) {
if (eventDao == null) {
throw new IllegalArgumentException("eventDao cannot be null");
}
if (userDao == null) {
throw new IllegalArgumentException("userDao cannot be null");
}
if (userRepository == null) {
throw new IllegalArgumentException("userRepository cannot be null");
}
if (passwordEncoder == null) {
throw new IllegalArgumentException("passwordEncoder cannot be null");
}
this.eventDao = eventDao;
this.userDao = userDao;
this.passwordEncoder = passwordEncoder;
}
示例2: passwordEncoder
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Bean(name="passwordEncoder")
@Autowired PasswordEncoder passwordEncoder(YadaConfiguration yadaConfiguration) {
if (yadaConfiguration.encodePassword()) {
return new BCryptPasswordEncoder();
}
return null;
}
示例3: DefaultCalendarService
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
final CalendarUserDao userDao,
final PasswordEncoder passwordEncoder) {
if (eventDao == null) {
throw new IllegalArgumentException("eventDao cannot be null");
}
if (userDao == null) {
throw new IllegalArgumentException("userDao cannot be null");
}
if (passwordEncoder == null) {
throw new IllegalArgumentException("passwordEncoder cannot be null");
}
this.eventDao = eventDao;
this.userDao = userDao;
this.passwordEncoder = passwordEncoder;
}
示例4: change
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Audit(action = "CHANGE_PASSWORD",
actionResolverName = "CHANGE_PASSWORD_ACTION_RESOLVER",
resourceResolverName = "CHANGE_PASSWORD_RESOURCE_RESOLVER")
@Override
public boolean change(final Credential credential, final PasswordChangeBean bean) {
Assert.notNull(credential, "Credential cannot be null");
Assert.notNull(bean, "PasswordChangeBean cannot be null");
final UsernamePasswordCredential c = (UsernamePasswordCredential) credential;
final PasswordEncoder encoder = Beans.newPasswordEncoder(passwordManagementProperties.getJdbc().getPasswordEncoder());
final String password = encoder.encode(bean.getPassword());
final int count = this.jdbcTemplate.update(passwordManagementProperties.getJdbc().getSqlChangePassword(), password, c.getId());
return count > 0;
}
示例5: DefaultCalendarService
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
final CalendarUserDao userDao,
final JdbcOperations jdbcOperations,
final PasswordEncoder passwordEncoder) {
if (eventDao == null) {
throw new IllegalArgumentException("eventDao cannot be null");
}
if (userDao == null) {
throw new IllegalArgumentException("userDao cannot be null");
}
if (jdbcOperations == null) {
throw new IllegalArgumentException("jdbcOperations cannot be null");
}
if (passwordEncoder == null) {
throw new IllegalArgumentException("passwordEncoder cannot be null");
}
this.eventDao = eventDao;
this.userDao = userDao;
this.jdbcOperations = jdbcOperations;
this.passwordEncoder = passwordEncoder;
}
示例6: calendarUserAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
/**
* The PreAuthenticatedAuthenticationProvider does not process the {@link RolesAllowed} annotation.
* @ param authenticationUserDetailsService
* @return
*/
// @Description("PreAuthenticatedAuthenticationProvider will return the existing Authentication token from the authenticate method")
// @Bean
// public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
// return new PreAuthenticatedAuthenticationProvider(){{
// setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
// }};
// }
@Description("AuthenticationMnager that will generate an authentication token unlike {@link PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
CalendarService calendarService,
PasswordEncoder passwordEncoder){
return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
示例7: calendarUserAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationMnager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
CalendarService calendarService,
PasswordEncoder passwordEncoder){
return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
示例8: calendarUserAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationMnager that will generate an authentication token unlike {@link PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
CalendarService calendarService,
PasswordEncoder passwordEncoder){
return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
示例9: CalendarUserAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public CalendarUserAuthenticationProvider(final CalendarService calendarService,
final PasswordEncoder passwordEncoder) {
if (calendarService == null) {
throw new IllegalArgumentException("calendarService cannot be null");
}
if (passwordEncoder == null) {
throw new IllegalArgumentException("passwordEncoder cannot be null");
}
this.calendarService = calendarService;
this.passwordEncoder = passwordEncoder;
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:14,代码来源:CalendarUserAuthenticationProvider.java
示例10: daoAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider(UserDetailsService userDetailsService,
PasswordEncoder passwordEncoder) {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setUserDetailsService(userDetailsService);
provider.setPasswordEncoder(passwordEncoder);
return provider;
}
示例11: calendarUserAuthenticationProvider
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationManager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
CalendarService calendarService,
PasswordEncoder passwordEncoder){
return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
示例12: KeysController
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
KeysController(Environment env,
MongoTemplate mongo,
PasswordEncoder encoder) {
this.env = requireNonNull(env);
this.mongo = requireNonNull(mongo);
this.encoder = requireNonNull(encoder);
}
示例13: verifyPasswordEncoderByMD5
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void verifyPasswordEncoderByMD5() {
final PasswordEncoderProperties p = new PasswordEncoderProperties();
p.setType(PasswordEncoderProperties.PasswordEncoderTypes.DEFAULT.name());
p.setEncodingAlgorithm("MD5");
p.setCharacterEncoding("UTF-8");
final PasswordEncoder e = Beans.newPasswordEncoder(p);
assertTrue(e.matches("asd123", "bfd59291e825b5f2bbf1eb76569f8fe7"));
}
示例14: getterSetterPassword
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void getterSetterPassword() {
PasswordEncoder encoder = new BCryptPasswordEncoder();
String password = "my_password";
sut.setPassword(password);
assertTrue(encoder.matches(password, sut.getPassword()));
}
示例15: name
import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void name () throws Exception {
PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
for ( int i = 0 ; i < 10 ; i++ ) {
System.err.println( passwordEncoder.encode( "123456" ) );
}
}