Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UserValidator {
- private Cryptographer cryptographer;
- public boolean checkPassword(String userName, String password) {
- User user = UserGateway.findByName(userName);
- if (user != User.NULL) {
- String codedPhrase = user.getPhraseEncodedByPassword();
- String phrase = cryptographer.decrypt(codedPhrase, password);
- if ("Valid Password".equals(phrase)) {
- Session.initialize();
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement