You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sz...@op.pl on 2004/08/17 12:21:01 UTC
authentication-manager and application load
Hello ML users,
"On a successful authentication the framework invokes for each
application of the handler the load resource (if present). The content or result of the load resource is stored into the session context."
For God sake what IS THE NAME of that context. I've tried root node of
generated XML with no effect.
<authentication-manager>
<handlers>
<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>
</handlers>
</authentication-manager>
--
Best regards,
szefu
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re[2]: authentication-manager and application load
Posted by sz...@op.pl.
Hello Jan,
Thursday, August 19, 2004, 8:43:21 AM, you wrote:
JH> <map:pipeline>
JH> <map:match pattern="test.xml">
JH> <map:generate src="test.xml"/>
JH> <map:serialize type="xml"/>
JH> </map:match>
JH> <map:match pattern="**">
JH> <map:act type="auth-protect">
JH> <map:parameter name="handler"
JH> value="AuthenticationHandler"/>
JH> <map:parameter name="application" value="apptest"/>
JH> ...
JH> </map:act>
JH> </map:match>
JH> </map:pipeline>
"application" parameter - that was missing ... but doc doesn't mention
about it .. thanks!
--
Best regards,
szefu18
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re[2]: authentication-manager and application load
Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi Jan! .>
Thursday, August 19, 2004, 8:43:21 AM, you wrote:
JH> I've just tried a little test (I never worked with applications in
JH> authentication before)
JH> This does work fine:
<snip/>
JH> Inside the protected area I used an xsp to quickly get the session content:
JH> String test = <xsp-session-fw:getxml context="authentication"
JH> path="/application/test/data"/>;
JH> if ((test != null) && (test != ""))
JH> {
JH> <span>test:<xsp:expr>test</xsp:expr></span>
JH> }
JH> This gave me the "data" string correctly on my page.
It's a little inconvenient that ALL data is stored in authentication context
because it's available in protected areas. Let's say that we have some user
settings for logged in users and default for the others. It would be very nice
to chain global module and session-context but we can't because session-context
won't work propertly in not protected areas. We should use auth-protect, but
then user not logged in can't access this area (we want him to access). It's
vicious circle.
How solve this problem?
--
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl .>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: authentication-manager and application load
Posted by Jan Hoskens <jh...@schaubroeck.be>.
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) && (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
Re[2]: authentication-manager and application load
Posted by sz...@op.pl.
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!
--
Best regards,
szefu18 on edge of madness
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: authentication-manager and application load
Posted by Jan Hoskens <jh...@schaubroeck.be>.
When succesfully authenticated, a xml part should have been generated like:
<authentication>
<ID/>
<role/>
<data>
<some more fragments as you like>
</data>
</authentication>
Context of session is "authentication"
In xsp use:
<xsp-session-fw:getxml context="authentication" path="/authentication/ID"/>;
In flow use:
var contextMan = null;
try
{
contextMan
=cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE);
var sessionContext = contextMan.getContext("authentication");
var id =
documentFragment2String(sessionContext.getXML("/authentication/ID"));
}
finally
{
cocoon.releaseComponent(contextMan);
}
It's in the same document as you found the other sentence under
:(http://cocoon.apache.org/2.1/developing/webapps/authentication.html)
<snip>
Getting, setting and saving application information
Analogue to the access of the authentication data a resource can access
its application data:
<session:getxml context="authentication" path="/application/username"/>
<session:setxml context="authentication" path="/application/shoppingcart"><item1/><item2/></session:setxml>
The path underlies the same restrictions and rules as always, but it has
to start with "/application/".
</snip>
Kind Regards,
Jan
szefu18@op.pl wrote:
>Hello ML users,
>
>"On a successful authentication the framework invokes for each
>application of the handler the load resource (if present). The content or result of the load resource is stored into the session context."
>
>For God sake what IS THE NAME of that context. I've tried root node of
>generated XML with no effect.
>
><authentication-manager>
> <handlers>
> <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>
> </handlers>
> </authentication-manager>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org