srinath Posted June 11, 2010 Share Posted June 11, 2010 I am getting the following error when using LDAP auth. As far as I can see the information is coming back from the Ldap server and then this error occurs. If I use an internal user, everything works fine. java.lang.ClassCastException: com.sun.jndi.ldap.LdapCtx cannot be cast to org.springframework.ldap.core.DirContextAdapter org.springframework.security.ldap.SpringSecurityLdapTemplate$2.mapFromContext(SpringSecurityLdapTemplate.java:154) org.springframework.ldap.core.ContextMapperCallbackHandler.getObjectFromNameClassPair(ContextMapperCallbackHandler.java:67) org.springframework.ldap.core.CollectingNameClassPairCallbackHandler.handleNameClassPair(CollectingNameClassPairCallbackHandler.java:50) org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:297) org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:259) org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:606) org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:524) org.springframework.security.ldap.SpringSecurityLdapTemplate.searchForSingleAttributeValues(SpringSecurityLdapTemplate.java:170) org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator.getGroupMembershipRoles(DefaultLdapAuthoritiesPopulator.java:206) org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator.getGrantedAuthorities(DefaultLdapAuthoritiesPopulator.java:179) org.springframework.security.providers.ldap.LdapAuthenticationProvider.loadUserAuthorities(LdapAuthenticationProvider.java:243) org.springframework.security.providers.ldap.LdapAuthenticationProvider.authenticate(LdapAuthenticationProvider.java:231) org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188) org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46) org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82) org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:258) org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) com.jaspersoft.jasperserver.war.UserPreferencesFilter.doFilter(UserPreferencesFilter.java:175) org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) com.jaspersoft.jasperserver.api.logging.filter.BasicLoggingFilter.doFilter(BasicLoggingFilter.java:53) org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175) org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99) com.jaspersoft.jasperserver.war.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:67) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) Link to comment Share on other sites More sharing options...
markgard Posted July 13, 2010 Share Posted July 13, 2010 This looks to be an issue with fetching LDAP Group Memebership. If the user is not a member of any group then login works just fine. The other thing is that this looks to be related to the way SPRING is loaded, and classloaders. Like the LDAP stuff is geting loaded outside of the rest of the stuff. Hence the casting error. java.lang.ClassCastException: com.sun.jndi.ldap.LdapCtx cannot be cast to org.springframework.ldap.core.DirContextAdapter Link to comment Share on other sites More sharing options...
cng Posted August 2, 2010 Share Posted August 2, 2010 I had same error. It was caused by an error in configuration for the ldapAuthenticationProvider bean.When I specified value for the the groupSearchFilter property, I had : <property name="groupSearchFilter"><value>(&(memberUid={1})(objectclass=posixGroup))</value></property>instead of <property name="groupSearchFilter"><value>(&(uniqueMember={1})(objectclass=posixGroup))</value></property>I made the mistake of copying the configuration details I had used from the configuration of JasperServer3.5 . You need to use "uniqueMember" insetad of "memberIid" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now