You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by olivier demah <od...@messagio.com> on 2004/03/25 15:35:22 UTC

XSP Page : Session and Authentication

Hi,

I would like to know how i can get information that exist in the 
<authentication/> stream.

Here is my xsp page :

1-<xsp:logic>
2- String id_blog_user = request.getParameter("id_blog_user");
3- if (id_blog_user.equals(null)) {
4-     id_blog_user = <session:getxml context="authentication" 
path="/authentication/data/id_blog_user"/>
5- }
6- </xsp:logic>


i know that the line 4 is completly wrong but i dont know how to access 
to this data in xsp code.

regards.


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


Re: XSP Page : Session and Authentication

Posted by Torsten Curdt <tc...@vafer.org>.
olivier demah wrote:
> olivier demah a écrit :
> 
>> Hi,
>>
>> I would like to know how i can get information that exist in the 
>> <authentication/> stream.
>>
>> Here is my xsp page :
>>
>> 1-<xsp:logic>
>> 2- String id_blog_user = request.getParameter("id_blog_user");
>> 3- if (id_blog_user.equals(null)) {
>> 4-     id_blog_user = <session:getxml context="authentication" 
>> path="/authentication/data/id_blog_user"/>
>> 5- }
>> 6- </xsp:logic>
> 
> 
> i come back to my test :)
> 
> in my xsp page i would like to compare
> this  :
> <xsp-session-fw:getxml context="authentication" as="string" 
> path="/authentication/data/id_blog_user"/>
> 
> with this :
> String id_blog_user = request.getParameter("id_blog_user");
> 
> How?

As rule of thumb: if you are not sure how to do such things
put both in the xsp page, let it compile and have a look into
the repository (the generated java source file)

This helps a lot to see what is going on behind the tags.

cheers
--
Torsten



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


Re: XSP Page : Session and Authentication

Posted by olivier demah <od...@messagio.com>.
olivier demah a écrit :

> Hi,
>
> I would like to know how i can get information that exist in the 
> <authentication/> stream.
>
> Here is my xsp page :
>
> 1-<xsp:logic>
> 2- String id_blog_user = request.getParameter("id_blog_user");
> 3- if (id_blog_user.equals(null)) {
> 4-     id_blog_user = <session:getxml context="authentication" 
> path="/authentication/data/id_blog_user"/>
> 5- }
> 6- </xsp:logic>

i come back to my test :)

in my xsp page i would like to compare
this  :
<xsp-session-fw:getxml context="authentication" as="string" 
path="/authentication/data/id_blog_user"/>

with this :
String id_blog_user = request.getParameter("id_blog_user");

How?

Regards.

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


Re: XSP Page : Session and Authentication

Posted by olivier demah <od...@messagio.com>.
julien bloit a écrit :

>Hi,
>
>Use xsp-session-fw instead :
><xsp-session-fw:getxml context="authentication" as="xml"
>path="="/authentication/data/id_blog_user"/>
>
>and declare in your xsp tag :
>xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0"
>  
>
thanks !
i knew that had to exist :-)

>HTH,
>Julien Bloit
>
>----- Original Message ----- 
>From: "olivier demah" <od...@messagio.com>
>To: <us...@cocoon.apache.org>
>Sent: Thursday, March 25, 2004 3:35 PM
>Subject: XSP Page : Session and Authentication
>
>
>  
>
>>Hi,
>>
>>I would like to know how i can get information that exist in the
>><authentication/> stream.
>>
>>Here is my xsp page :
>>
>>1-<xsp:logic>
>>2- String id_blog_user = request.getParameter("id_blog_user");
>>3- if (id_blog_user.equals(null)) {
>>4-     id_blog_user = <session:getxml context="authentication"
>>path="/authentication/data/id_blog_user"/>
>>5- }
>>6- </xsp:logic>
>>
>>
>>i know that the line 4 is completly wrong but i dont know how to access
>>to this data in xsp code.
>>
>>regards.
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>  
>


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


Re: XSP Page : Session and Authentication

Posted by julien bloit <Ju...@ircam.fr>.
Hi,

Use xsp-session-fw instead :
<xsp-session-fw:getxml context="authentication" as="xml"
path="="/authentication/data/id_blog_user"/>

and declare in your xsp tag :
xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0"

HTH,
Julien Bloit

----- Original Message ----- 
From: "olivier demah" <od...@messagio.com>
To: <us...@cocoon.apache.org>
Sent: Thursday, March 25, 2004 3:35 PM
Subject: XSP Page : Session and Authentication


> Hi,
>
> I would like to know how i can get information that exist in the
> <authentication/> stream.
>
> Here is my xsp page :
>
> 1-<xsp:logic>
> 2- String id_blog_user = request.getParameter("id_blog_user");
> 3- if (id_blog_user.equals(null)) {
> 4-     id_blog_user = <session:getxml context="authentication"
> path="/authentication/data/id_blog_user"/>
> 5- }
> 6- </xsp:logic>
>
>
> i know that the line 4 is completly wrong but i dont know how to access
> to this data in xsp code.
>
> regards.
>
>
> ---------------------------------------------------------------------
> 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


Re: XSP Page : Session and Authentication

Posted by olivier demah <od...@messagio.com>.
olivier demah a écrit :

> i meet another big problem with the same subject.
>
> Currently i make a blog.
> On this one ; you can browse all pages except for posting anything.
> so Authentication Framework enters in the game to manage that.
> BUT : i only need to protect some page (for posting) not for reading 
> the page that displays the complet list of all the post.
> Where is the problem you will ask ?
> here is the problem :
> in the sitemap ; if you dont do the following pipeline on all pages 
> you loose the Authentication Context !
>
> with auth-protect :
>
>    <map:match pattern="foo.html">
>        <map:act type="auth-protect">
>            <map:parameter name="handler" value="mblog"/>
>            <map:aggregate element="root" label="content">
>                <map:part src="cocoon:/index.xml"/>
>                <map:part src="cocoon:/blog_user.xsp"/>
>            </map:aggregate>
>
>            <map:transform src="stylesheets/foo.xslt"/>
>        <map:serialize type="html"/>
>        <map:serialize/>
>        </map:act>
>
> the display is ok
>
> without the following errors occur :
>
> Request URI
>
> foo.html
>
> cause
>
> org.apache.cocoon.ProcessingException: 
> SessionManager.getContextFragment: Context 'authentication' not found.
>
>
>
> So my question is :
> How can i keep the authentication Context without protecting page 
> (without auth-protect i mean) ?

i my blog_user.xsp i have :
<?xml version="1.0" encoding="iso-8859-1"?>
<xsp:page   xmlns:xsp= "http://apache.org/xsp"
            xmlns:xsp-request= "http://apache.org/xsp/request/2.0"
            xmlns:xsp-session= "http://apache.org/xsp/session/2.0"
            xmlns:xsp-session-fw= "http://apache.org/xsp/session-fw/1.0"
            xmlns:session= "http://apache.org/xsp/session/2.0"
            xmlns:xsp-formval= "http://apache.org/xsp/form-validator/2.0"
            create-session= "true"
            xmlns:cxa= "http://cxa/logicsheet">
<blog_user>
<id_blog_user><xsp:expr><xsp-session-fw:getxml context="authentication" 
as="string" 
path="/authentication/data/id_blog_user"/></xsp:expr></id_blog_user>
<user_nick><xsp:expr><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_nick"/></xsp:expr></user_nick>
<user_pass><xsp:expr><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_pass"/></xsp:expr></user_pass>
<user_title><xsp:expr><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_title"/></xsp:expr></user_title>
<user_desc><xsp:expr><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_desc"/></xsp:expr></user_desc>
<user_gsm_no><xsp-session-fw:getxml context="authentication" as="string" 
path="/authentication/data/user_gsm_no"/></user_gsm_no>
<user_date_birth><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_date_birth"/></user_date_birth>
<user_color_bg><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_color_bg"/></user_color_bg>
<user_color_link><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_color_link"/></user_color_link>
<user_color_text><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_color_text"/></user_color_text>
<user_date_cre><xsp-session-fw:getxml context="authentication" 
as="string" path="/authentication/data/user_date_cre"/></user_date_cre>
<user_date_expire><xsp-session-fw:getxml context="authentication" 
as="string" 
path="/authentication/data/user_date_expire"/></user_date_expire>
<id_category><xsp-session-fw:getxml context="authentication" as="string" 
path="/authentication/data/id_category"/></id_category>
</blog_user>
</xsp:page>

That's why ; if i dont use <map:action type="auth-protect'> in the 
sitemap ; the error occurs.

I think i will try the following :
When a user comes on a given blog (and he is not logged) ; i have the 
id_blog he just chose to see ;
so i have to test this one to get info from the blog he visits from the 
database.
If its a logged user ; i get those info from my auth context because my 
id_blog will be empty.


Regards.


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


Re: XSP Page : Session and Authentication

Posted by olivier demah <od...@messagio.com>.
i meet another big problem with the same subject.

Currently i make a blog.
On this one ; you can browse all pages except for posting anything.
so Authentication Framework enters in the game to manage that.
BUT : i only need to protect some page (for posting) not for reading the 
page that displays the complet list of all the post.
Where is the problem you will ask ?
here is the problem :
in the sitemap ; if you dont do the following pipeline on all pages you 
loose the Authentication Context !

with auth-protect :

    <map:match pattern="foo.html">
        <map:act type="auth-protect">
            <map:parameter name="handler" value="mblog"/>
            <map:aggregate element="root" label="content">
                <map:part src="cocoon:/index.xml"/>
                <map:part src="cocoon:/blog_user.xsp"/>
            </map:aggregate>

            <map:transform src="stylesheets/foo.xslt"/>
        <map:serialize type="html"/>
        <map:serialize/>
        </map:act>

the display is ok

without the following errors occur :

Request URI

foo.html

cause

org.apache.cocoon.ProcessingException: SessionManager.getContextFragment: Context 'authentication' not found.



So my question is :
How can i keep the authentication Context without protecting page 
(without auth-protect i mean) ?

Regards.



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