You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Lester <le...@gmail.com> on 2013/09/25 17:10:55 UTC
JndiLdapRealm Configuration with Shiro
Hi ,
I am a newbie to Shiro, and was trying to connect to my Ldap Server using
JndiLdapRealm to authenticate the user, The setting in my .ini file are as
[main]
ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm
ldapRealm.userDnTemplate = email={0},ou=EXTDIR,dc=my-domain,dc=com
ldapRealm.contextFactory.url = ldap://localhost:389
ldapRealm.contextFactory.systemUsername = cn=Manager,dc=my-domain,dc=com
ldapRealm.contextFactory.systemPassword= [myLdapPassword]
ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5
and i am getting connecting issues
Caused by: org.apache.shiro.authc.AuthenticationException: LDAP
authentication failed.
at
org.apache.shiro.realm.ldap.JndiLdapRealm.doGetAuthenticationInfo(JndiLdapRealm.java:300)
at
org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
at
org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
at
org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
at
org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
at
org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
Please help me as i dont have any idea as wer i have gone wrong.
Any sample example with .ini and java class will really be very helpful.
Thanks,
Lester
--
View this message in context: http://shiro-user.582556.n2.nabble.com/JndiLdapRealm-Configuration-with-Shiro-tp7579174.html
Sent from the Shiro User mailing list archive at Nabble.com.
Re: JndiLdapRealm Configuration with Shiro
Posted by Les Hazlewood <lh...@apache.org>.
This is due to a javax.naming.AuthenticationException (not shown in your
stack trace above):
http://docs.oracle.com/javase/7/docs/api/javax/naming/AuthenticationException.html
Per that JavaDoc, it appears that the username/password was incorrect (or
the systemUsername/password). You could play around with configuration and
try different settings, etc, but I think the best thing to do to find out
exactly is to hook up a debugger and set a break point at line 295 and step
through the code to see how it acquires the LdapContext and see what is
failing exactly.
HTH,
--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
On Wed, Sep 25, 2013 at 8:10 AM, Lester <le...@gmail.com> wrote:
> Hi ,
>
> I am a newbie to Shiro, and was trying to connect to my Ldap Server using
> JndiLdapRealm to authenticate the user, The setting in my .ini file are as
>
> [main]
> ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm
> ldapRealm.userDnTemplate = email={0},ou=EXTDIR,dc=my-domain,dc=com
> ldapRealm.contextFactory.url = ldap://localhost:389
> ldapRealm.contextFactory.systemUsername = cn=Manager,dc=my-domain,dc=com
> ldapRealm.contextFactory.systemPassword= [myLdapPassword]
> ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5
>
>
> and i am getting connecting issues
>
>
>
>
> Caused by: org.apache.shiro.authc.AuthenticationException: LDAP
> authentication failed.
> at
>
> org.apache.shiro.realm.ldap.JndiLdapRealm.doGetAuthenticationInfo(JndiLdapRealm.java:300)
> at
>
> org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
> at
>
> org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
> at
>
> org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
> at
>
> org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
> at
>
> org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
>
>
>
> Please help me as i dont have any idea as wer i have gone wrong.
>
> Any sample example with .ini and java class will really be very helpful.
>
>
> Thanks,
> Lester
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/JndiLdapRealm-Configuration-with-Shiro-tp7579174.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>