java - Extending LdapLoginModule is not authorizing user -


i trying install custom authentication(required in application) using jaas. standalone.xml looks like

<security-domain name="other" cache-type="default">                 <authentication>                     <login-module code="com.app.user.extendedsec.extendedldapextloginmodule" flag="optional">                         <module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.ldapctxfactory"/>                         <module-option name="java.naming.provider.url" value="ldap://app.user.in:389"/>                         <module-option name="java.naming.security.authentication" value="simple"/>                         <module-option name="password-stacking" value="usefirstpass"/>                         <module-option name="principaldnprefix" value="cn="/>                         <module-option name="principaldnsuffix" value=",ou=test,dc=ads,dc=exilant,dc=in"/>                         <module-option name="rolesctxdn" value="ou=test,dc=ads,dc=exilant,dc=in"/>                         <module-option name="uidattributeid" value="member"/>                         <module-option name="matchonuserdn" value="false"/>                         <module-option name="roleattributeid" value="samaccountname"/>                         <module-option name="roleattributeisdn" value="true"/>                     </login-module>                     <login-module code="com.app.user.extendedsec.extendedusernamepasswordloginmodule" flag="required">                         <module-option name="unauthenticatedidentity" value="guest"/>                         <module-option name="password-stacking" value="usefirstpass"/>                         <module-option name="dsjndiname" value="java:/session-tracking-datasource-orcl"/>                         <module-option name="principalsquery" value="select password fusion_users userid=? , lockflag='false' , (upper(active_ind) != 'n' or active_ind null)"/>                         <module-option name="rolesquery" value="select usertype, 'roles' fusion_user_groups userid=?"/>                     </login-module> 

when authenticating , authorizing using db working fine. not able authenticate/authorize using ldap server

public class extendedldapextloginmodule extends ldaploginmodule {  private static logger _logger=logger.getlogger(extendedldapextloginmodule.class.getclass());    /**  * @param inputpassword: encrypted password request; expectedpassword: password active directive  * @return passed super class. true success, false 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 password before pass comparison     return super.validatepassword(passwordcodec.getdecryptedpassword(inputpassword), expectedpassword); } 

}

the password getting decrypted @ server side correctly.

am missing here?

thanks

assuming extending org.jboss.security.auth.spi.ldaploginmodule, should not override validatepassword() tries bind operation ldap server.

judging source code , comments @ jboss docs can use vanilla ldaploginmodule#validatepassword() , try login instead of password retrieval.

specifically, these comments jboss source code clarify this:

/** overriden return empty password string typically 1 cannot obtain user's password. override validatepassword ok. @return , empty password string */ protected string getuserspassword() throws loginexception {   return ""; }  /** validate inputpassword creating ldap initialcontext security_credentials set password.  @param inputpassword password validate. @param expectedpassword ignored */ protected boolean validatepassword(string inputpassword, string expectedpassword) 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -