本文整理汇总了Java中org.jasypt.util.password.BasicPasswordEncryptor.encryptPassword方法的典型用法代码示例。如果您正苦于以下问题:Java BasicPasswordEncryptor.encryptPassword方法的具体用法?Java BasicPasswordEncryptor.encryptPassword怎么用?Java BasicPasswordEncryptor.encryptPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jasypt.util.password.BasicPasswordEncryptor
的用法示例。
在下文中一共展示了BasicPasswordEncryptor.encryptPassword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import org.jasypt.util.password.BasicPasswordEncryptor; //导入方法依赖的package包/类
@Override
public void register(String email, String password, String nickname,
boolean gender) {
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
String encryptedPassword = passwordEncryptor.encryptPassword(password);
User user = new User();
user.setEmail(email);
user.setPassword(encryptedPassword);
user.setNickname(nickname);
user.setGender(gender);
user.setFollowerCount(0);
user.setFollowingCount(0);
user.setPostCount(0);
user.setTime(new Date());
userDAO.save(user);
}
示例2: sendEmail
import org.jasypt.util.password.BasicPasswordEncryptor; //导入方法依赖的package包/类
public String sendEmail(String email, String nickname, Date date) throws UnsupportedEncodingException {
String plain = email + nickname + date.getTime();
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
String encrypted = passwordEncryptor.encryptPassword(plain);
String urlEncodedString = java.net.URLEncoder.encode(encrypted, "UTF-8");
final String to = email;
final String subject = "AtMars Microblog New User Register Comfirmation Email";
final String content = "<div style='width:713px; background-color:#A1E0E9; padding-top:30px; padding-bottom:30px; margin: 0 auto;'><img src='" + serverURL + logo_img + "' width='160' /><img src='" + serverURL + poster_img + "' width='100%' /><div style='background-color:#FFFFFF; border-radius:3px; box-shadow:0 1px 3px rgba(0,0,0,0.25); border:1px solid #CCC; padding:20px 20px 20px 20px; margin-left:30px; margin-right:30px; margin-top:30px;'><p><b>Welcome to AtMars MicroBlog</b></p><p>Thank you for registering AtMars MicroBlog.</p><p>To comfirm the email address you provided during registration. please click the following link in 24 hours:</p><p><a href='" + serverURL + "checkEmail?email=" + email + "&ticket=" + urlEncodedString + "'>" + serverURL + "checkEmail?email=" + email + "&ticket=" + urlEncodedString + "</a></p><p>If this link does not work, copy and paste the link into your browser.</p></div></div>";
jmsTemplate.send(destination, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
MapMessage message = session.createMapMessage();
message.setString("To", to);
message.setString("Subject", subject);
message.setString("Content", content);
return message;
}
});
return encrypted;
}
示例3: CalculateTicket
import org.jasypt.util.password.BasicPasswordEncryptor; //导入方法依赖的package包/类
@Override
public String CalculateTicket(User user) throws UnsupportedEncodingException {
String plain = user.getEmail()+user.getNickname()+user.getTime().getTime();
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
String encrypted = passwordEncryptor.encryptPassword(plain);
String urlEncodedString = java.net.URLEncoder.encode(encrypted, "UTF-8");
return urlEncodedString;
}
示例4: getBasicEncryptedPassword
import org.jasypt.util.password.BasicPasswordEncryptor; //导入方法依赖的package包/类
public static String getBasicEncryptedPassword(String textPassword) {
BasicPasswordEncryptor encryptor = new BasicPasswordEncryptor();
return encryptor.encryptPassword(textPassword);
}