title: Extending LdapLoginModule is not authorizing user
body: <p>I was trying to install my custom authentication(required in the application) using JAAS.
  My standalone.xml looks like</p>
  
  <pre><code>&lt;security-domain name="other" cache-type="default"&gt;
                  &lt;authentication&gt;
                      &lt;login-module code="com.app.user.extendedSec.ExtendedLdapExtLoginModule" flag="optional"&gt;
                          &lt;module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory"/&gt;
                          &lt;module-option name="java.naming.provider.url" value="ldap://app.user.in:389"/&gt;
                          &lt;module-option name="java.naming.security.authentication" value="simple"/&gt;
                          &lt;module-option name="password-stacking" value="useFirstPass"/&gt;
                          &lt;module-option name="principalDNPrefix" value="cn="/&gt;
                          &lt;module-option name="principalDNSuffix" value=",OU=Test,DC=ads,DC=exilant,DC=in"/&gt;
                          &lt;module-option name="rolesCtxDN" value="OU=Test,DC=ads,DC=exilant,DC=in"/&gt;
                          &lt;module-option name="uidAttributeID" value="member"/&gt;
                          &lt;module-option name="matchOnUserDN" value="false"/&gt;
                          &lt;module-option name="roleAttributeID" value="sAMAccountName"/&gt;
                          &lt;module-option name="roleAttributeIsDN" value="true"/&gt;
                      &lt;/login-module&gt;
                      &lt;login-module code="com.app.user.extendedSec.ExtendedUsernamePasswordLoginModule" flag="required"&gt;
                          &lt;module-option name="unauthenticatedIdentity" value="guest"/&gt;
                          &lt;module-option name="password-stacking" value="useFirstPass"/&gt;
                          &lt;module-option name="dsJndiName" value="java:/session-tracking-dataSource-orcl"/&gt;
                          &lt;module-option name="principalsQuery" value="SELECT PASSWORD FROM FUSION_USERS WHERE USERID=? AND LOCKFLAG='false' and (upper(active_ind) != 'N' or active_ind is null)"/&gt;
                          &lt;module-option name="rolesQuery" value="SELECT USERTYPE, 'Roles' FROM FUSION_USER_GROUPS WHERE USERID=?"/&gt;
                      &lt;/login-module&gt;
  </code></pre>
  
  <p>When it is authenticating and authorizing using DB it is working fine. But is not able to authenticate/authorize using ldap server</p>
  
  <pre><code>public class ExtendedLdapExtLoginModule extends LdapLoginModule {
  
  private static Logger _logger=Logger.getLogger(ExtendedLdapExtLoginModule.class.getClass());
  
  
  
  /**
   * @param inputPassword: encrypted password from request; expectedPassword: password from active directive
   * @return passed to the super class. True for success, false for failure.
   */
  @Override
  protected boolean validatePassword(String inputPassword, String expectedPassword) {
      _logger.debug("ExtendedLdapExtLoginModule: Input encrypted: " + inputPassword);
      _logger.debug("ExtendedLdapExtLoginModule: Input decrypted: " + PasswordCodec.getDecryptedPassword(inputPassword));
      _logger.debug("ExtendedLdapExtLoginModule: Expected: " +expectedPassword);
  
      //  Decrypt the password before pass it for comparison
      return super.validatePassword(PasswordCodec.getDecryptedPassword(inputPassword), expectedPassword);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The password is getting decrypted at server side correctly.</p>
  
  <p>Am i missing something here?</p>
  
  <p>Thanks
                      
                  </p>