类org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder源码实例Demo

下面列出了怎么用org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder的API类实例代码及写法,或者点击链接到github查看源代码。


private void addSessionContextToLogging() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    String tokenValue = "EMPTY";
    if (authentication != null && !Strings.isNullOrEmpty(authentication.getDetails().toString())) {
        MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-1");
        tokenValue = encoder.encodePassword(authentication.getDetails().toString(), "not_so_random_salt");
    }
    MDC.put(TOKEN_SESSION_KEY, tokenValue);

    String userValue = "EMPTY";
    if (authentication != null && !Strings.isNullOrEmpty(authentication.getPrincipal().toString())) {
        userValue = authentication.getPrincipal().toString();
    }
    MDC.put(USER_SESSION_KEY, userValue);
}
 
源代码2 项目: unitime   文件: UserEditForm.java

public static String encodePassword(String clearTextPassword) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(clearTextPassword, null);
}
 
源代码3 项目: unitime   文件: PasswordChangeBackend.java

private static String encode(String password) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(password, null);
}
 
源代码4 项目: unitime   文件: DbAuthenticateModule.java

/**
 * Gets the MD5 hash and encodes it in Base 64 notation
 * 
 * @param clearTextPassword
 * @return
 * @throws NoSuchAlgorithmException
 */
public static String getEncodedPassword(String clearTextPassword) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(clearTextPassword, null);
}
 
 类方法
 同包方法