1 2 Previous Next 20 Replies Latest reply on Jul 24, 2008 10:06 AM by Shane Bryzak

    Seam identity login

    guy bashan Apprentice

      I am having a weird behavior with Seam and identity login.


      1) My username is actually an email. I use identity.rememberMe. It seems like the data after the @ character is being truncated. for example if I use: xx@xxx.com, the username data stored in the cookie is: xx.
      2) After doing a logout, then login again, Seam is persisting a new password to my database (it is possible that by making a login, the user data is being persisted to the database somehow)?


      This is my bean code:



      @Name("authenticator")
      public class AuthenticatorAction
      {
        @In
        Session myDatabase;
      
        @Out(required = false, scope = SESSION)
        private User user;
      
        @Logger
        private Log log;
      
        @In
        Identity identity;
        
        public boolean authenticate()
        {
          String password = DigestUtils.shaHex(identity.getPassword());
          log.info("Authenticating user: #{identity.username} with password: #{identity.password}");
          List results = nikoniansDatabase.createQuery("select u from User u where " +
              "u.email=#{identity.username} and u.password=:password").setParameter("password", password).list();
          if (results.size() == 0)
          {
            log.info("User: #{identity.username} was not found");
            return false;
          }
          else
          {
            user = (User)results.get(0);
            log.info("User: #{user.email} (user.userId) was authenticated");
            return true;
          }
        }
      }
      


        1 2 Previous Next