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