SHARE
TWEET

Untitled

a guest May 27th, 2018 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class AuthService implements UserDetailsService {
  2.   //autowired by grails from our resources.xml bean definition
  3.   PasswordEncoder passwordEncoder
  4.   UserDetails loadUserByUsername(String email) {
  5.     def user = User.findByEmail(email)
  6.     if (user)
  7.       return new UserWrapper(user)
  8.     else
  9.       throw new UsernameNotFoundException(email + ' could not be located')
  10.   }
  11.  
  12.   //convenience method for adding handling password encoding and saving a user
  13.   User createUser(User user, String password) {
  14.     user.password = passwordEncoder.encodePassword(password, null)
  15.     user.save(failOnError: true)
  16.   }
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top