You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Skip Carter <sk...@taygeta.com> on 2007/03/07 00:10:37 UTC

Using auth info in sitemap

I am trying to use the remote user name info from a password protected
page within a sitemap pipeline.  It seems to require a selector
for the user name but I can't seem to find documentation about
any such selector.  Does one exist or do I have to write my own.

I want my pipeline to have something that looks along the lines
of,

     <map:match pattern="protected/index.html">
         <map:select type="session-attribute">
             <map:parameter name="attribute-name" value="user"/>
                 <map:when test="user1">
                     ...
                 </map:when>
                 <map:when test="user2">
                     ...
                 </map:when>
                 <map:otherwise>
                     ...
                 </map:otherwise>
        </map:select>    
     </map:match>


ATM, I am using cocoon 2.1.6


-- 
 Dr. Everett (Skip) Carter           Phone: 831-641-0645 FAX:  831-641-0647
 Taygeta Network Security Services   email: skip@taygeta.net
 1340 Munras Ave., Suite 314         WWW: http://www.taygeta.net/
 Monterey, CA. 93940            










---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Using auth info in sitemap

Posted by Tobia <to...@linux.it>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Using auth info in sitemap

Posted by Skip Carter <sk...@taygeta.com>.
On Wed, 7 Mar 2007 12:16:56 -0000
"Warrell" <wa...@iquo.co.uk> wrote:

> Are you using the Cocoon Authentication framework or Apache http to protect
> your document?

Cocoon
 
> -----Original Message-----
> From: Skip Carter [mailto:skip@taygeta.com] 
> Sent: 06 March 2007 23:11
> To: users@cocoon.apache.org
> Subject: Using auth info in sitemap
> 
> I am trying to use the remote user name info from a password protected page
> within a sitemap pipeline.  It seems to require a selector for the user name
> but I can't seem to find documentation about any such selector.  Does one
> exist or do I have to write my own.
> 
> I want my pipeline to have something that looks along the lines of,
> 
>      <map:match pattern="protected/index.html">
>          <map:select type="session-attribute">
>              <map:parameter name="attribute-name" value="user"/>
>                  <map:when test="user1">
>                      ...
>                  </map:when>
>                  <map:when test="user2">
>                      ...
>                  </map:when>
>                  <map:otherwise>
>                      ...
>                  </map:otherwise>
>         </map:select>    
>      </map:match>
> 
> 
> ATM, I am using cocoon 2.1.6

-- 
 Dr. Everett (Skip) Carter           Phone: 831-641-0645 FAX:  831-641-0647
 Taygeta Network Security Services   email: skip@taygeta.net
 1340 Munras Ave., Suite 314         WWW: http://www.taygeta.net/
 Monterey, CA. 93940            










---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Using auth info in sitemap

Posted by Warrell <wa...@iquo.co.uk>.
Are you using the Cocoon Authentication framework or Apache http to protect
your document?

-----Original Message-----
From: Skip Carter [mailto:skip@taygeta.com] 
Sent: 06 March 2007 23:11
To: users@cocoon.apache.org
Subject: Using auth info in sitemap

I am trying to use the remote user name info from a password protected page
within a sitemap pipeline.  It seems to require a selector for the user name
but I can't seem to find documentation about any such selector.  Does one
exist or do I have to write my own.

I want my pipeline to have something that looks along the lines of,

     <map:match pattern="protected/index.html">
         <map:select type="session-attribute">
             <map:parameter name="attribute-name" value="user"/>
                 <map:when test="user1">
                     ...
                 </map:when>
                 <map:when test="user2">
                     ...
                 </map:when>
                 <map:otherwise>
                     ...
                 </map:otherwise>
        </map:select>    
     </map:match>


ATM, I am using cocoon 2.1.6


-- 
 Dr. Everett (Skip) Carter           Phone: 831-641-0645 FAX:  831-641-0647
 Taygeta Network Security Services   email: skip@taygeta.net
 1340 Munras Ave., Suite 314         WWW: http://www.taygeta.net/
 Monterey, CA. 93940            










---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org