fetchingattributedetails

Fetching Attributes: Profile Attributes, Session Attributes, and Policy Response Attributes

Applications sometimes rely on the presence of user-specific information. For example, user-specific information can be used to provide personalization for an application, such as a user-specific greeting. Note that for such a scenario, code must be written and available in the application server to call the attribute by name and to possibly perform other tasks.

Through the three following attributes types, J2EE agents provide functionality that make attributes, often user-specific attributes, available:
Profile Attribute Processing
Response Attributes Processing
Session Attributes Processing

The items in the above list are links to descriptions of the attribute types.

To enable any of the three attribute types to be fetched, you must set the appropriate J2EE agent properties. By default, these properties are set to NONE, which means they are not fetched. If you want to configure the agent to fetch an attribute type, set the respective property to any one of the three following fetching modes: HTTP_COOKIE, HTTP_HEADER, REQUEST_ATTRIBUTE

Fetching Modes
The following descriptions provide information about the three modes available for fetching attributes, regardless of the attribute type.

Fetching Attributes as HTTP Headers
When the agent is configured to provide attributes as HTTP headers, the attributes can be retrieved for the application by a snippet of code using the following methods on the javax.servlet.http.HttpServletRequest interface:

long getDateHeader(java.lang.String name)
java.lang.String getHeader(java.lang.String name)
java.util.Enumeration getHeaderNames()
java.util.Enumeration getHeaders(java.lang.String name)
int getIntHeader(java.lang.String name)

The J2EE property labeled Fetch Attribute Date Format (com.sun.identity.agents.config.attribute.date.format), controls the parsing of a date value from an appropriate string as set in the attribute.

Multi-valued attributes can be retrieved as an instance of java.util.Enumeration from the following method:
java.util.Enumeration getHeaders(java.lang.String name)

Fetching Attributes as Request Attributes
When the agent is configured to provide attributes as request attributes, the agent populates these attribute values into HttpServletRequest as attributes that can later be used by the application as necessary. These attributes are populated as java.util.Set objects, which must be cast to this type before they can be successfully used.

Fetching Attributes as Cookies
When the agent is configured to provide attributes as cookies, the necessary values are set as server specific cookies by the agent with the path specified as "/."

Multi-valued attributes are set as a single cookie value in a manner that concatenates all values of the attribute into a single string using a separator character that can be specified by the property labeled Cookie Separator Character (com.sun.identity.agents.config.attribute.cookie.separator), . One of the tasks of the application is to parse this string back into the individual values to ensure the correct interpretation of the multi-valued attributes for the logged on user.

When you set attributes to be fetched attributes as cookies, also use the cookie reset feature to ensure that these cookies get cleaned up from the client browser when the client browser's session expires.

The Common Attributes Fetch Processing Related Properties
This section lists the most common J2EE properties used to configure the attribute fetching feature. Therefore, if you configure the agent to fetch any of the attribute types, review the following properties to determine what further configuration might be necessary:

Cookie Separator Character (com.sun.identity.agents.config.attribute.cookie.separator)

Fetch Attribute Date Format (com.sun.identity.agents.config.attribute.date.format)

Attribute Cookie Encode (com.sun.identity.agents.config.attribute.cookie.encode)


QUESTIONS/COMMENTS? Add them below!


Comments:


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact