Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.oblivionsoftware.raid.security;
- /**
- * Imports
- */
- import com.oblivionsoftware.raid.entity.User;
- import com.oblivionsoftware.raid.entity.UserServiceBean;
- import javax.ejb.EJB;
- import javax.ejb.Stateless;
- /**
- * SecurityServiceBean.
- *
- * @author Dustin Dobervich <ddobervich@gmail.com>
- */
- @Stateless
- public class SecurityServiceBean
- {
- /**
- * Private Data
- */
- @EJB
- private UserServiceBean userService;
- @EJB
- private PasswordEncoderServiceBean encoder;
- /**
- * Validates a users credentials.
- *
- * @param username The username
- * @param password The password
- * @return True if valid, false otherwise
- */
- public boolean validateCredentials(String username, String password)
- {
- User user = this.userService.findUserByUsername(username);
- String encodedPassword = this.encoder.encodePassword(password, user.getSalt());
- return encodedPassword.equals(password);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement