4 Replies Latest reply on May 27, 2009 3:29 AM by Nikolay Elenkov

    IdentityManager username case-insensitive

    Nico Wollenzin Newbie

      Hi,


      I am using Seams new Identitymanager and I can't believe that I am the only one who wants to store and check his usernames without any case.


      I want that my users can log in with his username in any case. JohnDoe should validate as far as johndoe or jOhNDoE.


      What am I missing in my config or how do I have to override my JPAIdentityStore to create such a behavior?



      My first steps look like this:


      @Name("jpaIdentityStore")
      @Install(precedence = Install.APPLICATION)
      @Scope(ScopeType.APPLICATION)
      @BypassInterceptors
      @Startup
      public class LowerCaseIdentityStore extends JpaIdentityStore {
      
          private static final long serialVersionUID = 1L;
      
          public LowerCaseIdentityStore() {
              super();
              setUserClass(NutzerKonto.class);
              setRoleClass(NutzerRolle.class);
          }
      
          @Logger
          Log log;
          
          @Override
          public boolean authenticate(String username, String password) {
              username = username.toLowerCase();
              log.info("authenticating " + username + " " + password);
              return super.authenticate(username, password);
          }   
      }



      If I log in with JohnDoe I still get a NoSuchUserException: User JohnDoe not Found. I expected no Uppercase letters in this state.


      What am I doing wrong?


      greets


      Nico