cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hoskens ...@schaubroeck.be>
Subject Re: authentication-manager and application load
Date Thu, 19 Aug 2004 06:43:21 GMT
I've just tried a little test (I never worked with applications in 
authentication before)
This does work fine:

sitemap snippets:
<authentication-manager>
                <handlers>
                    <handler name="AuthenticationHandler">
                        <redirect-to uri="cocoon:/login.html"/>
                        <authentication uri="cocoon:raw:/authenticate"/>
                        <applications>
                            <application name="apptest">
                                <load uri="cocoon:/test.xml"/>
                            </application>
                        </applications>
                    </handler>
                </handlers>
     </authentication-manager>

        <map:pipeline>
       
            <map:match pattern="test.xml">
                <map:generate src="test.xml"/>
                <map:serialize type="xml"/>
            </map:match>

            <map:match pattern="**">
                <map:act type="auth-protect">
                    <map:parameter name="handler" 
value="AuthenticationHandler"/>
                    <map:parameter name="application" value="apptest"/>
                      ...
                 </map:act>
             </map:match>
          </map:pipeline>

the application file that's loaded with first match:
<?xml version="1.0" encoding="utf-8" ?>
<test>
    <data>data</data>
</test>

Inside the protected area I used an xsp to quickly get the session content:
String test = <xsp-session-fw:getxml context="authentication" 
path="/application/test/data"/>;
                            if ((test != null) &amp;&amp; (test != ""))
                            {
                                <span>test:<xsp:expr>test</xsp:expr></span>
                            }

This gave me the "data" string correctly on my page.
If you need to know how the full session context authentication looks 
like, just do this:
    String test = <xsp-session-fw:getxml context="authentication" 
path="/"/>;
Then (if you have your logs set correctly to debug, not error) there 
should be an entrance in your core.log file that shows something like:

DEBUG   (2004-08-19) 08:29.57:029   [core.session-manager] 
(/cocoon-2.1.5/site/index.html) 
http8080-Processor3/DefaultSessionManager: BEGIN getContextFragment 
name=authentication, path=/
DEBUG   (2004-08-19) 08:29.57:029   [core.session-manager] 
(/cocoon-2.1.5/site/index.html) 
http8080-Processor3/DefaultContextManager: BEGIN getContext 
name=authentication
DEBUG   (2004-08-19) 08:29.57:029   [core.session-manager] 
(/cocoon-2.1.5/site/index.html) 
http8080-Processor3/DefaultContextManager: END getContext 
context=org.apache.cocoon.webapps.authentication.context.AuthenticationContext@52a2e3
DEBUG   (2004-08-19) 08:29.57:039   [core.session-manager] 
(/cocoon-2.1.5/site/index.html) 
http8080-Processor3/DefaultSessionManager: END getContextFragment 
documentFragment=<?xml version="1.0" encoding="UTF-8"?>
<authentication>
<ID>user</ID>
<role>role</role>
<data>
<type>cocoon.authentication</type>
<media>html</media>
</authentication>
<application>
<test>
    <data>data</data>
</test>
</application>

Hope this works for you.

Kind regards,
Jan


szefu18@op.pl wrote:

>Hello Jan,
>
>JH> Getting, setting and saving application information
>
>JH> Analogue to the access of the authentication data a resource can access
>JH> its application data:
>
>JH> <session:getxml context="authentication" path="/application/username"/>
>JH> <session:setxml context="authentication" 
>JH> path="/application/shoppingcart"><item1/><item2/></session:setxml>
>
>JH> The path underlies the same restrictions and rules as always, but it has
>JH> to start with "/application/".
>
>Thanks. OK load data should be in authentication context but it isn't
>there.
>
><handler name="warsztat-auth">
>                                                <redirect-to uri="cocoon://warsztat/users/login.html"/>
>                                                <authentication uri="cocoon:raw:/authenticate"/>
>                                                <applications>
>                                                        <application name="gdpl">
>                                                                <load uri="cocoon:/LoadUser"/>
>                                                        </application>
>                                                </applications>
>                                        </handler>
>
>LoadUser creates correct xml and is called for sure (changing pipeline
>name causes error on login). But nothing producet by this pipeline is found
>in authentication context. Help!
>
>
>  
>


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


Mime
View raw message