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


Java PasswordEncoder類代碼示例

本文整理匯總了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;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:22,代碼來源:DefaultCalendarService.java

示例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;
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:8,代碼來源:YadaSecurityConfig.java

示例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;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:18,代碼來源:DefaultCalendarService.java

示例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;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:14,代碼來源:JdbcPasswordManagementService.java

示例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;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:23,代碼來源:DefaultCalendarService.java

示例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);
    }
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:21,代碼來源:SecurityConfig.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:8,代碼來源:CustomAuthorizationConfig.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:8,代碼來源:SecurityConfig.java

示例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;
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:9,代碼來源:UaaConfiguration.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:8,代碼來源:CustomAuthorizationConfig.java

示例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);
}
 
開發者ID:membaza,項目名稱:email-service,代碼行數:9,代碼來源:KeysController.java

示例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"));
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:10,代碼來源:DefaultPasswordEncoderTests.java

示例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()));
}
 
開發者ID:2DV603NordVisaProject,項目名稱:nordvisa_calendar,代碼行數:8,代碼來源:UserTest.java

示例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" ) );
	}
}
 
開發者ID:yujunhao8831,項目名稱:spring-boot-start-current,代碼行數:10,代碼來源:PasswordEncoderTest.java


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