CAS and LDAP integration

51 views
Skip to first unread message

Adam Toy

unread,
Sep 6, 2013, 12:23:20 PM9/6/13
to ozonepla...@googlegroups.com
I'm having issues authenticating OWF through CAS and LDAP. This is the stacktrace I'm getting:

2013-09-06 11:55:58,567 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] - <org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler failed to authenticate [callbackUrl: https://localhost:8443/owf/secure/receptor]>
2013-09-06 11:55:58,569 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO
: [callbackUrl: https://localhost:8443/owf/secure/receptor]
WHAT
: supplied credentials: [callbackUrl: https://localhost:8443/owf/secure/receptor]
ACTION
: AUTHENTICATION_FAILED
APPLICATION
: CAS
WHEN
: Fri Sep 06 11:55:58 EDT 2013
CLIENT IP ADDRESS
: 127.0.0.1
SERVER IP ADDRESS
: 127.0.0.1
=============================================================

>
2013-09-06 11:55:58,570 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO
: art62@georgetown.edu
WHAT
: error.authentication.credentials.bad
ACTION
: PROXY_GRANTING_TICKET_NOT_CREATED
APPLICATION
: CAS
WHEN
: Fri Sep 06 11:55:58 EDT 2013
CLIENT IP ADDRESS
: 127.0.0.1
SERVER IP ADDRESS
: 127.0.0.1
=============================================================

>
2013-09-06 11:55:58,572 ERROR [org.jasig.cas.web.ServiceValidateController] - <TicketException generating ticket for: [callbackUrl: https://localhost:8443/owf/secure/receptor]>
org
.jasig.cas.ticket.TicketCreationException: error.authentication.credentials.bad
    at org
.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket_aroundBody6(CentralAuthenticationServiceImpl.java:325)
    at org
.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket_aroundBody7$advice(CentralAuthenticationServiceImpl.java:57)
    at org
.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket(CentralAuthenticationServiceImpl.java:1)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org
.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    at org
.perf4j.aop.AbstractTimingAspect$1.proceed(AbstractTimingAspect.java:47)
    at org
.perf4j.aop.AgnosticTimingAspect.runProfiledMethod(AgnosticTimingAspect.java:53)
    at org
.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:45)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org
.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    at org
.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    at com
.github.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:126)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org
.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    at org
.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org
.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy25
.delegateTicketGrantingTicket(Unknown Source)
    at org
.jasig.cas.web.ServiceValidateController.handleRequestInternal(ServiceValidateController.java:138)
    at org
.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org
.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org
.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org
.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org
.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org
.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax
.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax
.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org
.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:128)
    at org
.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:57)
    at org
.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1)
    at org
.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org
.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org
.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org
.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org
.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org
.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org
.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org
.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com
.github.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:63)
    at org
.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org
.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org
.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org
.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
    at org
.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
    at org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org
.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org
.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org
.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
    at org
.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org
.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java
.lang.Thread.run(Thread.java:722)
Caused by: error.authentication.credentials.bad
    at org
.jasig.cas.authentication.handler.BadCredentialsAuthenticationException.<clinit>(BadCredentialsAuthenticationException.java:38)
    at org
.jasig.cas.authentication.AuthenticationManagerImpl.authenticateAndObtainPrincipal(AuthenticationManagerImpl.java:109)
    at org
.jasig.cas.authentication.AbstractAuthenticationManager.authenticate_aroundBody0(AbstractAuthenticationManager.java:57)
    at org
.jasig.cas.authentication.AbstractAuthenticationManager.authenticate_aroundBody1$advice(AbstractAuthenticationManager.java:57)
    at org
.jasig.cas.authentication.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:1)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org
.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    at org
.perf4j.aop.AbstractTimingAspect$1.proceed(AbstractTimingAspect.java:47)
    at org
.perf4j.aop.AgnosticTimingAspect.runProfiledMethod(AgnosticTimingAspect.java:53)
    at org
.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:45)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org
.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    at org
.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    at com
.github.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:126)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:601)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org
.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org
.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    at org
.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
    at org
.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org
.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy24
.authenticate(Unknown Source)
    at org
.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket_aroundBody6(CentralAuthenticationServiceImpl.java:297)
   
... 71 more
2013-09-06 11:55:58,590 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

Here's my OWFsecurity.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   
xmlns:sec="http://www.springframework.org/schema/security"
   
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"
>
   
<sec:http entry-point-ref="casProcessingFilterEntryPoint">
       
<sec:access-denied-handler error-page="/denied.gsp"/>

       
<sec:intercept-url pattern="/unauthorized.jsp" filters="none" />
       
<sec:intercept-url pattern="/cas*.jsp" filters="none" requires-channel="https" />
       
<sec:intercept-url pattern="/js-lib/ext-*/**" filters="none"/>
       
<sec:intercept-url pattern="/themes/common/images/logout/**" filters="none" />
       
<sec:intercept-url pattern="/logout.jsp" filters="none" />
       
<sec:intercept-url pattern="/administration/monitoring" access="ROLE_ADMIN" />
       
<sec:intercept-url pattern="/admin/**" access="ROLE_ADMIN"    requires-channel="https" />
   
<sec:intercept-url pattern="/**" access="ROLE_USER" requires-channel="https" />
   
<sec:x509 subject-principal-regex="CN=(.*?)," user-service-ref="userService" />
       
<sec:custom-filter ref="ozoneLogoutFilter" position="LOGOUT_FILTER"/><!-- CUSTOM LOGOUT FILTER -->

       
<!-- FILTER THAT CREATES OUR CUSTOM COOKIE -->
       
<sec:custom-filter ref="ozoneCookieFilter" before="ANONYMOUS_FILTER"/>
       
<sec:custom-filter ref="casSingleSignOutFilter" after="LOGOUT_FILTER"/><!-- CAS SIGN OUT FILTER -->
         
<sec:custom-filter ref="casProcessingFilter" after="CAS_FILTER" />
       
<sec:port-mappings>
           
<sec:port-mapping http="${ozone.unsecurePort}" https="${ozone.port}"/>
       
</sec:port-mappings>
   
</sec:http>

   
<sec:authentication-manager alias="authenticationManager">
       
<sec:authentication-provider ref="casAuthenticationProvider" />
   
</sec:authentication-manager>

   
<import resource="ozone-security-beans/LdapBeans.xml" />
   
<import resource="ozone-security-beans/UserServiceBeans.xml" />
   
<import resource="ozone-security-beans/OWFCasBeans.xml" />
   
<import resource="ozone-security-beans/OWFLogInOutBeans.xml" />
   
<import resource="ozone-security-beans/ListenerBeans.xml" />

</beans>

And my LdapBeans.xml file:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   
xmlns:sec="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" >


   
<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
       
<!-- The URL of the ldap server, along with the base path that all other ldap path will be relative to -->
       
<constructor-arg value="ldaps://141.161.88.155:636/dc=ldapprod,dc=arg,dc=edu"/>
       
<property name="userDn" value="cn=TestUser,ou=People,dc=ldapprod,dc=arg,dc=edu" />
       
<property name="password" value="TestPW" />
   
</bean>

   
<bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
       
<constructor-arg>
           
<bean class="org.springframework.security.ldap.authentication.PasswordComparisonAuthenticator">
               
<constructor-arg ref="contextSource" />
               
<property name="userSearch" ref="ldapUserSearch" />
               
<property name="passwordEncoder" >
                   
<!-- Probably want to use a more secure PasswordEncoder in a real installation -->
                   
<bean class="org.springframework.security.authentication.encoding.PlaintextPasswordEncoder" />
               
</property>
           
</bean>
       
</constructor-arg>
       
<constructor-arg ref="authoritiesPopulator" />                       <!-- Populates authorities in the UserDetails object -->
       
<property name="userDetailsContextMapper" ref="userDetailsMapper" /> <!-- Adds OWF groups to the UserDetails object -->
   
</bean>

   
<bean id="authoritiesPopulator" class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
       
<constructor-arg ref="contextSource"/>
       
<constructor-arg value="ou=owfRole"/> <!-- search base for determining what roles a user has -->
   
</bean>

   
<bean id="ldapUserSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
       
<constructor-arg value="ou=People" /> <!-- search base for finding User records -->
   
<constructor-arg value="(mail={0})" /> <!-- filter applied to entities under the search base in order to find a given user.
                                                this default searches for an entity with a matching uid -->

       
<constructor-arg ref="contextSource" />
   
</bean>

   
<!-- Custom class that goes back to the ldap database to search for OWF group records and also adds
         extra attributes from the user's ldap record to the UserDetails object.
         The class implementation of this will likely need to be changed out for differnt setups -->

   
<bean id="userDetailsMapper" class="ozone.securitysample.authentication.ldap.OWFUserDetailsContextMapper">
       
<constructor-arg ref="contextSource" />
       
<constructor-arg value="ou=owfGroup" /> <!-- search base for finding OWF group membership -->
       
<constructor-arg value="(uniqueMember={0})" /> <!-- filter that matches only groups that have the given username listed
                                                      as a "member" attribute -->

   
</bean>

   
<bean id="ldapUserService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService">
       
<constructor-arg ref="ldapUserSearch" />
       
<constructor-arg ref="authoritiesPopulator" />
       
<property name="userDetailsMapper" ref="userDetailsMapper" />
   
</bean>

</bean>


Reply all
Reply to author
Forward
0 new messages