I'm working on a webapplication using the following:
- Apache Shiro 1.2.4
- Tomcat 8
- Java 8
I'm trying to authenticate users via an LDAP realm.
I tested the login with JXplorer using the following values:
- BaseND: ou=students,ou=users,o=data
- UserDN/BindDN: cn={my distinguished name},ou=students,ou=users,o=data
- JXplorer also has a certificate that I imported
Now to my problem:
I have to authenticate the users not based on cn but rather on uid.
This wont work however.
Workflow suggested by LDAP-Admin at my company:
I have a system user which (as far as I understood) should connect to the LDAP-Server, searches the user based on the given uid and returns the cn for that user.
In a second step it should then be possible to authenticate the user with his cn just like its done (successfully) in JXplorer.
My shiro.ini configuration looks like this for my test LDAP (not the one I'm trying to authenticate against now)
ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm
ldapRealm.userDnTemplate = cn={0},ou=People,dc=maxcrc,dc=com
ldapRealm.contextFactory.url = ldap://localhost:389
The problem I'm facing right now is that I cannot find information about how to configure my shiro.ini file in a way to math the suggested workflow from above.
Question #1
Can I use the standard org.apache.shiro.realm.ldap.JndiLdapRealm (how do I configure it)? Especially for the integration of the certificate I could not find anything appropriate.
Question #2
Do I need to create a custom JndiLdapRealm for this "2 step authentication" and how could such a Realm look like?