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


Java StandardPasswordEncoder.encode方法代碼示例

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


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

示例1: encodePassword

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
/**
 * Encodes a given raw password with random salt via Spring {@link StandardPasswordEncoder}.
 *
 * @param  rawPassword  plaintext password
 *
 * @return  encoded password
 */
public static String encodePassword(String rawPassword) {

    /**
     * TODO: Think about to use a better password encoder
     *
     * Comment within StandardPasswordEncoder:
     *
     * If you are developing a new system,
     * {@link org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder} is
     * a better choice both in terms of security and interoperability with other languages.
     */

    StandardPasswordEncoder encoder = new StandardPasswordEncoder();

    return encoder.encode(rawPassword);
}
 
開發者ID:synyx,項目名稱:urlaubsverwaltung,代碼行數:24,代碼來源:CryptoUtil.java

示例2: encodePassword

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
@Test
public void encodePassword() throws Exception {
	StandardPasswordEncoder encoder = new StandardPasswordEncoder();
	String result = encoder.encode("password01");
	assertTrue(encoder.matches("password01", result));
	logger.info("Encoded password is {}", result);
	assertThat(result,is(notNullValue()));
}
 
開發者ID:lucamartellucci,項目名稱:bookshop-api,代碼行數:9,代碼來源:PasswordEncoder.java

示例3: standardEncoder

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
public String standardEncoder(String password) {
    StandardPasswordEncoder standardPasswordEncoder = new StandardPasswordEncoder();
    String encoded = standardPasswordEncoder.encode(password);
    return encoded;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:6,代碼來源:AppPasswordEncoder.java

示例4: encode

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
public static String encode(String password) {
    StandardPasswordEncoder encoder = new StandardPasswordEncoder();
    String encodedPassword = encoder.encode(password);
    return encodedPassword;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:6,代碼來源:CryptoSha256PasswordEncoderMain.java

示例5: encodePassword

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
public static String encodePassword(String password) {
	StandardPasswordEncoder encoder = new StandardPasswordEncoder();
	String encodedPassword = encoder.encode(password);
	return encodedPassword;
}
 
開發者ID:tlin-fei,項目名稱:ds4p,代碼行數:6,代碼來源:PasswordEncoder.java

示例6: encodePassword

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
@Test
public void encodePassword() {
	StandardPasswordEncoder encoder = new StandardPasswordEncoder("test");
	String result = encoder.encode(USER_ADMIN);
	assertTrue(encoder.matches(USER_ADMIN, result));
}
 
開發者ID:thiagoandrade6,項目名稱:security-acl,代碼行數:7,代碼來源:SecurityAclTest.java

示例7: encodePassword

import org.springframework.security.crypto.password.StandardPasswordEncoder; //導入方法依賴的package包/類
@Override
public String encodePassword(String rawPassword, Object salt) {
	StandardPasswordEncoder encoder = new StandardPasswordEncoder();
	
	return encoder.encode(rawPassword);
}
 
開發者ID:FinTP,項目名稱:fintp_api,代碼行數:7,代碼來源:CustomPasswordEncoder.java


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