Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

For instance, this mapping in attribute-map.xml would instruct the SP to map the user's favorite fruit user attribute to an HTTP header named "favFruit".

Code Block
xml
xml
titleConfiguring the SP to map the user's FavoriteFruit user attribute to a header named "favFruit"xml
<Attribute name="https://example.org/myAttributes/FavoriteFruit" id="favFruit"/>

...

This filter is declared in web.xml like this:

Code Block
xml
xml
titleConfiguring a filter to capture selected HTTP headers and feed them to the Person Directory DAOxml
<filter>
    <filter-name>HttpHeaderFilter</filter-name>
    <filter-class>edu.jhu.services.persondir.support.http.HttpHeaderFilter</filter-class>
    <init-param>
        <param-name>personDirectoryContextLocation</param-name>
        <param-value>properties/contexts/personDirectoryContext.xml</param-value>
    </init-param>
</filter>
...
<filter-mapping>
    <filter-name>HttpHeaderFilter</filter-name>
    <servlet-name>Login</servlet-name>
</filter-mapping>

The data access object itself is declared something like this:

Code Block
xml
xml
titleDeclaring a HTTP header as a source of a user attributexml
<bean id="httpHeaderAttributeSource" class="edu.jhu.services.persondir.support.http.HttpHeaderPersonAttributeDao">
  <constructor-arg>
    <value>edu.jhu.services.persondir.support.http.HttpHeaderPersonAttributeDao</value>
  </constructor-arg>
  <property name="columnsToAttributes">
    <map>
      <entry key="favFruit">
        <value>favorite_fruit</value></entry>
    </map>
  </property>
</bean>

...

This source of user attributes can be declared alongside sources such as RDBMS queries and LDAP queries.

Code Block
xml
xml
titleConfiguring HTTP headers as source of attributes alongside other sourcesxml
<bean id="mergedPersonAttributeDao" class="org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl">
  <property name="personAttributeDaos">
    <list>
      <ref bean="uPortalJdbcAttributeSource"/>
      <ref bean="uPortalLdapAttributeSource"/>
      <ref bean="httpHeaderAttributeSource"/>
    </list>
  </property>
  <property name="merger">
    <bean class="org.jasig.services.persondir.support.merger.MultivaluedAttributeMerger"/>
  </property>
</bean>

...

JSR-168 portlets can read values of their declared user attributes at runtime via a JSR-168 API:

Code Block
java
java
titleReading a portlet user attribute at runtime in a JSR-168 portletjava
// in the course of handling a PortletRequest named 'request'
Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
String surname = (String) userInfo.get("favorite_color");
// presumably, do something interesting based on the user's favorite color...

...

A JSR-168 portlet so provisioned would then read the SAML assertion as a user attribute at runtime via the JSR-168 user attribute API:

Code Block
java
java
titleReading the 'samlAssertion' portlet user attribute at runtime in a JSR-168 portletjava
// in the course of handling a PortletRequest named 'request'
Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
String surname = (String) userInfo.get("samlAssertion");
// make use of this Assertion to authenticate to backing services via the Portlet Client Library to be designed below...

...