3 Replies Latest reply on Jul 9, 2007 9:27 AM by dheeraj segapalli

    authenticator action..password hashing

    dheeraj segapalli Newbie

      I was trying to compare the hashed password stored in my database with the password the end user types by hashing the user entered password.
      I am posting the code that i used in authenticator action java file.
      I am able deploy the application but cannot login.
      public class AuthenticatorAction implements Authenticator
      @PersistenceContext EntityManager em;

      @Out(required=false, scope = SESSION)
      private User user;

      public boolean authenticate()

      List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.passwordhash=this.calculatehash(#{identity.password})")

      if ( results.size()==0 )
      return false;
      user = (User) results.get(0);
      return true;

      private String calculatehash(String loginpassword)

      String newhash = Util.createPasswordHash("MD5", Util.BASE16_ENCODING, null, null, loginpassword);
      return newhash;
      ..the error i get after deploying it is
      .. it returns that it cannot find the function named calculatepasswordhash...

      Can anyone tell me why is it not calculating hash?