本文整理汇总了Java中org.jasypt.util.password.BasicPasswordEncryptor类的典型用法代码示例。如果您正苦于以下问题:Java BasicPasswordEncryptor类的具体用法?Java BasicPasswordEncryptor怎么用?Java BasicPasswordEncryptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicPasswordEncryptor类属于org.jasypt.util.password包,在下文中一共展示了BasicPasswordEncryptor类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: compareSimple2EncryptedPassword
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public static boolean compareSimple2EncryptedPassword(String plainPassword, String encryptedPassword) {
if (plainPassword == null || encryptedPassword == null) {
return false;
}
if (plainPassword.trim().length() == 0 || encryptedPassword.trim().length() == 0) {
return false;
}
BasicPasswordEncryptor encryptor = new BasicPasswordEncryptor();
return encryptor.checkPassword(plainPassword, encryptedPassword);
}
示例4: getPasswordEncryptor
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public PasswordEncryptor getPasswordEncryptor() {
switch (this) {
case NONE : return null;
case BASIC : return new BasicPasswordEncryptor();
case STRONG : return new StrongPasswordEncryptor();
default : throw new IllegalStateException("No support for encryptor type " + this);
}
}
示例5: checkLogin
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
@Override
public boolean checkLogin(String email, String password) {
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
List l = userDAO.findByEmail(email);
if (l == null || l.size() == 0) {
return false;
}
User user = (User) userDAO.findByEmail(email).get(0);
if (passwordEncryptor.checkPassword(password, user.getPassword())) {
return true;
}
return false;
}
示例6: 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;
}
示例7: AuthenticUserWithTicket
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
@Override
public boolean AuthenticUserWithTicket(int userId, String ticket) {
User u = userDAO.findById(userId);
String plainPassword = u.getEmail()+u.getNickname()+u.getTime().getTime();
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
return passwordEncryptor.checkPassword(plainPassword, ticket);
}
示例8: checkLink
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public boolean checkLink(String email, String nickname, Date date, String encrypted) throws UnsupportedEncodingException {
String plain = email + nickname + date.getTime();
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
if(!passwordEncryptor.checkPassword(plain, encrypted))
{
return false;
}
Date now = new Date();
if(now.getTime() - now.getTime() > 86400000)
{
return false;
}
final String subject = "Your New Account in AtMars Microblog has been Activated";
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>Congratulations to you! Your email account " + email + " is activated. Thank you for registering AtMars MicroBlog.</p><p>Try to use AtMars to follow your friends:</p><p> <a href='" + serverURL + "'>" + serverURL + "</a></p><p>We are glad to meet you in AtMars MicroBlog.</p></div></div>";
final String to = email;
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 true;
}
示例9: DefaultSecurityHelper
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public DefaultSecurityHelper() {
passwordEncryptor = new BasicPasswordEncryptor();
}
示例10: getBasicEncryptedPassword
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public static String getBasicEncryptedPassword(String textPassword) {
BasicPasswordEncryptor encryptor = new BasicPasswordEncryptor();
return encryptor.encryptPassword(textPassword);
}
示例11: matchPassword
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
private boolean matchPassword(String password) {
PasswordEncryptor pe = new BasicPasswordEncryptor();
return pe.checkPassword(password, encryptedPassword);
}
示例12: authenticate
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public boolean authenticate(String unencryptedPassword) {
return (new BasicPasswordEncryptor()).checkPassword(unencryptedPassword, password);
}
示例13: setPassword
import org.jasypt.util.password.BasicPasswordEncryptor; //导入依赖的package包/类
public void setPassword(String unencryptedPassword) {
this.password = (new BasicPasswordEncryptor()).encryptPassword(unencryptedPassword);
}