...
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<Attribute name="https://example.org/myAttributes/FavoriteFruit" id="favFruit"/> |
...
This filter is declared in web.xml like this:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 | ||||||
---|---|---|---|---|---|---|
| ||||||
// 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 | ||||||
---|---|---|---|---|---|---|
| ||||||
// 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... |
...