Skip to content

Instantly share code, notes, and snippets.

@kevinfoote
Last active December 25, 2015 03:18
Show Gist options
  • Save kevinfoote/6908427 to your computer and use it in GitHub Desktop.
Save kevinfoote/6908427 to your computer and use it in GitHub Desktop.
using persondir to map header attributes into CAS's attributeRepository
<!--
         PULL and Map HeadarAttributes for use
-->
<bean id="currentUserProvider"
      class="org.jasig.cas.adaptors.trusted.authentication.handler.support.PrincipalBearingCredentialsAuthenticationHandler"/>
<bean id="usernameAttributeProvider" class="org.jasig.services.persondir.support.SimpleUsernameAttributeProvider">
    <property name="usernameAttribute" value="username" />
</bean>
<bean id="requestAttributeSourceFilter" class="org.jasig.services.persondir.support.web.RequestAttributeSourceFilter">
    <property name="usernameAttribute" value="userName" />
    <property name="additionalDescriptors" ref="requestAdditionalDescriptors" />
    <property name="remoteUserAttribute" value="userName" />
    <property name="serverNameAttribute" value="serverName" />
    <property name="processingPosition" value="BOTH" />
    <property name="headerAttributeMapping">
        <map>
           <entry key="eppa" value="eduPersonPrimaryAffiliation" />
           <entry key="uid" value="uid" />
           <entry key="eppn" value="eduPersonPrincipalName" />
        </map>
    </property>
</bean>
<bean id="requestAdditionalDescriptors" class="org.jasig.services.persondir.support.MediatingAdditionalDescriptors">
    <property name="delegateDescriptors">
        <list>
            <bean class="org.jasig.services.persondir.support.AdditionalDescriptors" scope="globalSession">
               <aop:scoped-proxy />
            </bean>
            <bean class="org.jasig.services.persondir.support.AdditionalDescriptors" scope="request">
               <aop:scoped-proxy />
            </bean>
        </list>
    </property>
</bean>
<bean id="requestAttributesDao" class="org.jasig.services.persondir.support.AdditionalDescriptorsPersonAttributeDao">
    <property name="descriptors" ref="requestAdditionalDescriptors" />
    <property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
</bean>
<!--
         END building attributes
-->
<!--
         The attribute list is sort of dynamic now due to the fact that you are
         creating the backingMap through the filter step above. It is assumed
         you know the data that is going through the filter and if you want it or
         not.
-->
<bean id="attributeRepository"
      class="org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl">
    <property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
    <property name="personAttributeDaos">
        <list>
            <ref bean="requestAttributesDao" />
            <!--ref bean="mergedPersonAttributeDao" /-->
        </list>
    </property>
</bean>
@yarrasree
Copy link

Hi,

Suppose, I want to include password field in request attributeMap object. Could you please help me?

Thanks
Srinivas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment