0 Replies Latest reply on Mar 6, 2014 11:47 AM by scelisl

    Hash configuration on Security Realm

    scelisl

      Hi.

      I'm configuring the authorization and authentication for my app.

      The question is: are the hashAlgorithm and the hashEncoding options the same algorithm and encoding for the password stored in a database?

      In the database, the passwords have not any algorithm encryption.

       

      I've configured the xml like this:

                          <authentication>

                              <login-module code="Database" flag="required">

                                  <module-option name="dsJndiName" value="java:jboss/datasources/sinfosia"/>

                                  <module-option name="principalsQuery" value="select passusers from users where nickusers=?"/>

                                  <module-option name="rolesQuery" value="select accessusers_idaccessusers, 'Roles' from users us inner join accessusers aut on us.accessusers_idaccessusers =                                    aut.nameaccessusers where us.nickusers = ?"/>

                                  <module-option name="hashAlgorithm" value="SHA-256"/>

                                  <module-option name="hashEncoding" value="BASE64"/>

                                  <module-option name="unauthenticatedIdentity" value="guest"/>

                              </login-module>

                              <login-module code="RoleMapping" flag="required">

                                  <module-option name="rolesProperties" value="file:${jboss.server.config.dir}/siaRealm.properties"/>

                                  <module-option name="replaceRole" value="false"/>

                              </login-module>

                          </authentication>

      .......

                      <datasource jta="false" jndi-name="java:/jdbc/sinfosia" pool-name="sinfosia" enabled="true" use-ccm="false">

                          <connection-url>jdbc:mysql://localhost:3306/sinfosia</connection-url>

                          <driver-class>com.mysql.jdbc.Driver</driver-class>

                          <driver>mysql_com.mysql.jdbc.Driver_5_1</driver>

                          <pool>

                              <min-pool-size>5</min-pool-size>

                              <max-pool-size>15</max-pool-size>

                          </pool>

                          <security>

                              <user-name>root</user-name>

                          </security>

                          <validation>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>false</background-validation>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>

       

      But i can't login. The server log dont show any exception or error.

      I followed the steps in Migrating a Java EE App from GlassFish to WildFly · WildFly

       

      Thanks.