[jboss-user] [Security & JAAS/JBoss] - authenticator action..password hashing

dheerajsega do-not-reply at jboss.com
Fri May 25 15:46:07 EDT 2007


 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})")
            .getResultList();
      
      if ( results.size()==0 )
      {
         return false;
      }
      else
      {
         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?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048777#4048777

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048777



More information about the jboss-user mailing list