Skip Carter wrote:
> I am trying to use the remote user name info from a password protected
> page within a sitemap pipeline.

Yau can access the user id.  It's not necessarily equal to the username,
because it's the value returned in the <ID> tag by your authentication
resource (the one that validates usernames and passwords.)

You can access it like this (took me a while to figure it out and it's
probably not the best way, but it works)

  session.getAttribute(LONG_STRING).getHandler(HANDLER_NAME).getUserId()

Where LONG_STRING is this thing:
"org.apache.cocoon.webapps.authentication.components.DefaultAuthenticationManager/UserStatus"
and HANDLER_NAME is the name of your authentication handler.

I don't think there's an easy way to access that information from the
sitemap, but it's fairly easy to do so from flowscript and actions.
I suggest reading it from there and saving it in a request attribute:

  request.setAttribute("userid", session.getAttribute...)

so that you can put in your sitemap:

  <select type="request-attribute">
    <parameter name="attribute-name" value="userid"/>
    <when test="user1">
      ...
    </when>
  </select>


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to