jndi - Looping through Shiro LDAP Realm on Authenitcation Failure -


i'm getting odd error. if pass in valid user/password shiro ldap ok if combination not valid throws exception , keeps on looping through shiro realm code. in debugger stays in shiro code except 1 override method:

  public class myjndildaprealm extends jndildaprealm {   public myjndildaprealm () {     super(); }  @override protected authenticationinfo queryforauthenticationinfo(authenticationtoken token,         ldapcontextfactory ldapcontextfactory) throws namingexception {  object principal = token.getprincipal(); object credentials = token.getcredentials();  principal = getldapprincipal(token);  ldapcontext ctx = null; try {      ctx = ldapcontextfactory.getldapcontext(principal, credentials);       //context opened successfully, means credentials valid.  return authenticationinfo:      return createauthenticationinfo(token, principal, credentials, ctx); } {     ldaputils.closecontext(ctx); }   }              <bean id="shirofilter" class="org.apache.shiro.spring.web.shirofilterfactorybean">     <property name="securitymanager" ref="securitymanager"/>     <property name="loginurl" value="/ldaplogin"/>     <property name="unauthorizedurl" value="/ldaplogin"/>     <property name="successurl" value="/ldaplogin"/>           <property name="filterchaindefinitions">         <value>             [urls]             /** = ssl[8443],authc, customauthfilter             [main]             /logout = logout         </value>     </property>    </bean>  <bean id="securitymanager" class="org.apache.shiro.web.mgt.defaultwebsecuritymanager">      <property name="realms">         <list>              <ref bean="authenticateldaprealm"/>              <ref bean="authenticatedbrolesrealm"/>              <ref bean="dbauthorizingrealm"/>         </list>     </property>     <property name="authenticator.authenticationstrategy">         <bean class="org.apache.shiro.authc.pam.allsuccessfulstrategy"/>     </property> </bean>  <bean id="lifecyclebeanpostprocessor" class="org.apache.shiro.spring.lifecyclebeanpostprocessor"/>  <bean id="authenticateldaprealm" class="security.myjndildaprealm">     <property name="contextfactory" ref="contextfactory" />     <property name="userdntemplate" value="cn={0},ou=remote,o=off" />  </bean>  <bean id="contextfactory" class="org.apache.shiro.realm.ldap.jndildapcontextfactory">   <property name="url" value="ldap://172.25.3.91:389"/> </bean>  <bean id="authenticatedbrolesrealm" class="security.dbrolesrealm"> </bean>  <bean id="swidbauthorizingrealm" class="security.dbauthorizingrealm"> </bean>  <bean class="org.springframework.aop.framework.autoproxy.defaultadvisorautoproxycreator" depends-on="lifecyclebeanpostprocessor"/> <bean class="org.apache.shiro.spring.security.interceptor.authorizationattributesourceadvisor">     <property name="securitymanager" ref="securitymanager"/> </bean> 

somehow custom filter problem. went passthruauthenticationfilter , problem solved.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -