Sun Glassfish SocialSite Developer's Guide

Creating the Authentication Delegation Service

This is an example of what a web application may include as a context delegation service page (socialsite_context.jsp). Although a JSP file is used here, the concepts should directly translate to other page-generation languages (such as PHP):

01: <context>
02:  <viewer>
03:   <user name="<%=request.getRemoteUser()%>" />
04:  </viewer>
05:  <owner>
06:   <user name="<%=request.getRemoteUser()%>" />
07:  </owner>
08: </context>

The sample code returns an XML representation of the identity context for the current user's session. Note that the "context delegation service" is not required to be included within the host application, In this example, it is convenient to include the context delegation service within the host application to leverage a local HttpSession context.