Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11013

Hash encoding Exception when using @DatabaseIdentityStoreDefinition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 14.0.0.Final
    • Security
    • None
    • Hide

      Deploy one Application which uses a valid @DatabaseIdentityStoreDefinition, such as:

      @DatabaseIdentityStoreDefinition(dataSourceLookup = "java:/MySqlDS", callerQuery = "select password from USERS where login=?", groupsQuery = "select role, 'Roles' from USERS where login=?", priority = 30)
      @ApplicationScoped
      
      public class BeanConfig {
      }
      

      A valid datasource must be bound in JNDI and the USERS table needs to be created with at least one user/password combination:

      CREATE TABLE USERS(login VARCHAR(64) PRIMARY KEY, password VARCHAR(64), role VARCHAR
      (64));
      INSERT into USERS values('test', 'test',’Admin’);
      

      I'm attaching a reproducer with a README.md

      Show
      Deploy one Application which uses a valid @DatabaseIdentityStoreDefinition, such as: @DatabaseIdentityStoreDefinition(dataSourceLookup = "java:/MySqlDS" , callerQuery = "select password from USERS where login=?" , groupsQuery = "select role, 'Roles' from USERS where login=?" , priority = 30) @ApplicationScoped public class BeanConfig { } A valid datasource must be bound in JNDI and the USERS table needs to be created with at least one user/password combination: CREATE TABLE USERS(login VARCHAR(64) PRIMARY KEY, password VARCHAR(64), role VARCHAR (64)); INSERT into USERS values( 'test' , 'test' ,’Admin’); I'm attaching a reproducer with a README.md

    Description

      When deploying one application using @DatabaseIdentityStoreDefinition, upon successful login, the following exception is thrown

      java.lang.IllegalArgumentException: Bad hash encoding
      	at org.glassfish.soteria.identitystores.hash.Pbkdf2PasswordHashImpl$EncodedPasswordHash.decode(Pbkdf2PasswordHashImpl.java:209)
      	at org.glassfish.soteria.identitystores.hash.Pbkdf2PasswordHashImpl$EncodedPasswordHash.<init>(Pbkdf2PasswordHashImpl.java:191)
      	at org.glassfish.soteria.identitystores.hash.Pbkdf2PasswordHashImpl.verify(Pbkdf2PasswordHashImpl.java:147)
      	at org.glassfish.soteria.identitystores.DatabaseIdentityStore.validate(DatabaseIdentityStore.java:121)
      	at org.glassfish.soteria.identitystores.DatabaseIdentityStore.validate(DatabaseIdentityStore.java:101)
      	at org.jboss.weldx.security.enterprise.identitystore.IdentityStore$635317201$Proxy$_$$_WeldClientProxy.validate(Unknown Source)
      	at org.glassfish.soteria.cdi.DefaultIdentityStoreHandler.validate(DefaultIdentityStoreHandler.java:97)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            fmarchio@redhat.com Francesco Marchioni (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: