Study http://jasig.github.io/cas/4.2.x/installation/Configuring-Principal-Resolution.html#principalresolver-vs-authenticationhandler
From: [email protected] [mailto:[email protected]] On Behalf Of Mikko Tuumanen Sent: Thursday, February 4, 2016 11:39 PM To: CAS Community <[email protected]> Subject: [cas-user] principal attributes from ldap in CAS 4.2 I've been trying to upgrade from 3.x to 4.2, but I don't understand how to set up user attributes from cas. In 3.x I had <bean id="attributeRepository" class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao"> in deployerConfigContext.xml and <c:if test="${fn:length(assertion.chainedAuthentications) > 0}"> <cas:attributes> <c:forEach var="auth" items="${assertion.chainedAuthentications}"> <c:forEach var="attr" items="${auth.principal.attributes}"> <c:forEach var="v" items="${attr.value}"> <cas:${fn:escapeXml(attr.key)}>${fn:escapeXml(v)}</cas:${fn:escapeXml(attr.key)}> </c:forEach> </c:forEach> </c:forEach> </cas:attributes> </c:if> in protocol/2.0/casServiceValidationSuccess.jsp This worked perfectly with a CAS 3.x. And then the 4.2: <bean id="ldapAuthenticationHandler" class="org.jasig.cas.authentication.LdapAuthenticationHandler" p:principalIdAttribute="uid" c:authenticator-ref="authenticator"> <property name="principalAttributeMap"> <map> <entry key="mail" value="email" /> <entry value="givenname" key="givenName" /> <entry value="surname" key="sn" /> <entry value="telephone" key="telephoneNumber" /> </map> </property> </bean> This part works. I can see from slapd and cas debug that cas really asks and gets those attributes from ldap. I use a jsonServiceRegistryDao and in the config json file I have "attributeReleasePolicy" : { "@class" : "org.jasig.cas.services.ReturnAllAttributeReleasePolicy" } This works too. And then the thing I didn't figure out: In the default deployerConfigContext.xml, there is a: <bean id="attributeRepository" class="org.jasig.services.persondir.support.NamedStubPersonAttributeDao" p:backingMap-ref="attrRepoBackingMap" /> If I let that stay there, I get the attributes from the attrRepoBackingMap and not from ldap. If I remove the attributeRepository bean completely, cas won't start: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.jasig.services.persondir.IPersonAttributeDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=attributeRepository)} <mailto:%[email protected](value=attributeRepository)%7d> If I try to use org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao as attributeRepository like I did with 3.x, cas won't start because Caused by: java.lang.ClassNotFoundException: org.springframework.ldap.filter.Filter I think I shouldn't need to use the LdapPersonAttributeDao because LdapAuthenticationHandler already picks up the attributes. What am I missing here? What should I use as an attributeRepository? I even tried to alias the LdapAuthenticationHandler to be the attributeRepository but that didn't help either. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]> . Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
