本文整理匯總了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" ) );
}
}