You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Carsten Ziegeler <cz...@s-und-n.de> on 2003/09/03 09:53:10 UTC

RE: *****SPAM***** RE: No "authentication" context?

Sonny Sukumar wrote:
>
>
> 1.) Upon authentication, I store the user's email address in the
> <ID> tag in
> the doc the auth resource returns.
> 2.) My assumption until this point has been that the "authentication"
> context is now created in the session and stays there until the user logs
> out.  Furthemore, I've assumed that I should be able to fetch the ID tag
> contents at any time while the user is logged in (the email
> address, in my
> case).
>
Yes, that's absolutely correct.

> I'm now using auth-protect with the correct handler in the
> pipeline, but I
> still get the same error--context "authentication" can't be found.
>
Without further information, I can only say that it should work that way.

You can have a look at the sample of the authentication block, the protected
pipeline there uses the session transformer to display the whole
authentication
context.

Carsten


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


RE: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
You are very kind, thankyou.

I was on the right track just missing some vital (undocumented) information.

Regards,

Paul.

On Wed, 3 Sep 2003 13:34:25 +0200, Carsten Ziegeler wrote
> Ok, if you have a component manager in the variable "manager", do this:
> 
> (it's free typed into the mail without syntax checking)
> 
> import org.apache.avalon.framework.component.Component;
> import org.apache.cocoon.webapps.session.ContextManager;
> 
> ContextManager cm =
> (ContextManager)this.manager.lookup(ContextManager.ROLE);
> try {
>   SessionContext sc = cm.getContext(CONTEXT_NAME);
> 
>   // use the context here
> 
> } finally {
>   manager.release((Component)cm);
> }
> 
> This is really all I can provide you, you have to figure out the rest.
> 
> Carsten
> 
> Paul Bowler wrote:
> >
> > I've had a look but a simple code snippet would be very useful as
> > it is not clear from the source what
> > SessionPreTransformer is for or how it deals with session data.
> >
> > I hope you have time to help.
> >
> > Regards,
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org



--
Paul Bowler
Aventix Associates Ltd

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


RE: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
I do now, and it's working fine.

Many thanks for you kind help.

Paul.

On Wed, 3 Sep 2003 14:37:09 +0200, Carsten Ziegeler wrote
> The name is correct. Do you have the auth-protect action in your pipeline?
> 
> Carsten
> 
> > -----Original Message-----
> > From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> > Sent: Wednesday, September 03, 2003 2:23 PM
> > To: users@cocoon.apache.org
> > Subject: RE: No "authentication" context?
> > 
> > 
> > OK, now I have:
> > 
> > ContextManager cm = (ContextManager) 
> > this.manager.lookup(ContextManager.ROLE);
> > SessionContext sc = cm.getContext("authentication");
> > 
> > My session context (after logging on) is always null. What should 
> > the context name be? I have tried many different 
> > things and they are all null. A getContextNames() method would be 
> > very useful here!
> > 
> > Regards,
> > 
> > Paul.
> > 
> > On Wed, 3 Sep 2003 13:34:25 +0200, Carsten Ziegeler wrote
> > > Ok, if you have a component manager in the variable "manager", do this:
> > > 
> > > (it's free typed into the mail without syntax checking)
> > > 
> > > import org.apache.avalon.framework.component.Component;
> > > import org.apache.cocoon.webapps.session.ContextManager;
> > > 
> > > ContextManager cm =
> > > (ContextManager)this.manager.lookup(ContextManager.ROLE);
> > > try {
> > >   SessionContext sc = cm.getContext(CONTEXT_NAME);
> > > 
> > >   // use the context here
> > > 
> > > } finally {
> > >   manager.release((Component)cm);
> > > }
> > > 
> > > This is really all I can provide you, you have to figure out the rest.
> > > 
> > > Carsten
> > 
> > ---------------------------------------------------------------------
> > 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



--
Paul Bowler
Aventix Associates Ltd

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


RE: No "authentication" context?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
The name is correct. Do you have the auth-protect action in your pipeline?

Carsten

> -----Original Message-----
> From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> Sent: Wednesday, September 03, 2003 2:23 PM
> To: users@cocoon.apache.org
> Subject: RE: No "authentication" context?
> 
> 
> OK, now I have:
> 
> ContextManager cm = (ContextManager) 
> this.manager.lookup(ContextManager.ROLE);
> SessionContext sc = cm.getContext("authentication");
> 
> My session context (after logging on) is always null. What should 
> the context name be? I have tried many different 
> things and they are all null. A getContextNames() method would be 
> very useful here!
> 
> Regards,
> 
> Paul.
> 
> On Wed, 3 Sep 2003 13:34:25 +0200, Carsten Ziegeler wrote
> > Ok, if you have a component manager in the variable "manager", do this:
> > 
> > (it's free typed into the mail without syntax checking)
> > 
> > import org.apache.avalon.framework.component.Component;
> > import org.apache.cocoon.webapps.session.ContextManager;
> > 
> > ContextManager cm =
> > (ContextManager)this.manager.lookup(ContextManager.ROLE);
> > try {
> >   SessionContext sc = cm.getContext(CONTEXT_NAME);
> > 
> >   // use the context here
> > 
> > } finally {
> >   manager.release((Component)cm);
> > }
> > 
> > This is really all I can provide you, you have to figure out the rest.
> > 
> > Carsten
> 
> ---------------------------------------------------------------------
> 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: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
OK, now I have:

ContextManager cm = (ContextManager) this.manager.lookup(ContextManager.ROLE);
SessionContext sc = cm.getContext("authentication");

My session context (after logging on) is always null. What should the context name be? I have tried many different 
things and they are all null. A getContextNames() method would be very useful here!

Regards,

Paul.

On Wed, 3 Sep 2003 13:34:25 +0200, Carsten Ziegeler wrote
> Ok, if you have a component manager in the variable "manager", do this:
> 
> (it's free typed into the mail without syntax checking)
> 
> import org.apache.avalon.framework.component.Component;
> import org.apache.cocoon.webapps.session.ContextManager;
> 
> ContextManager cm =
> (ContextManager)this.manager.lookup(ContextManager.ROLE);
> try {
>   SessionContext sc = cm.getContext(CONTEXT_NAME);
> 
>   // use the context here
> 
> } finally {
>   manager.release((Component)cm);
> }
> 
> This is really all I can provide you, you have to figure out the rest.
> 
> Carsten

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


RE: No "authentication" context?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Ok, if you have a component manager in the variable "manager", do this:

(it's free typed into the mail without syntax checking)

import org.apache.avalon.framework.component.Component;
import org.apache.cocoon.webapps.session.ContextManager;

ContextManager cm =
(ContextManager)this.manager.lookup(ContextManager.ROLE);
try {
  SessionContext sc = cm.getContext(CONTEXT_NAME);

  // use the context here

} finally {
  manager.release((Component)cm);
}

This is really all I can provide you, you have to figure out the rest.

Carsten

Paul Bowler wrote:
>
> I've had a look but a simple code snippet would be very useful as
> it is not clear from the source what
> SessionPreTransformer is for or how it deals with session data.
>
> I hope you have time to help.
>
> Regards,
>


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


RE: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
I've had a look but a simple code snippet would be very useful as it is not clear from the source what 
SessionPreTransformer is for or how it deals with session data.

I hope you have time to help.

Regards,

Paul.

On Wed, 3 Sep 2003 11:22:23 +0200, Carsten Ziegeler wrote
> A slightly changed version is in Cocoon, in the SessionPreTransformer.java.
> 
> Carsten
> 
> > -----Original Message-----
> > From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> > Sent: Wednesday, September 03, 2003 11:03 AM
> > To: users@cocoon.apache.org
> > Subject: RE: No "authentication" context?
> > 
> > 
> > Do you have a snippet of code that does this?
> > 
> > Thanks,
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org



--
Paul Bowler
Aventix Associates Ltd

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


RE: No "authentication" context?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
A slightly changed version is in Cocoon, in the SessionPreTransformer.java.

Carsten

> -----Original Message-----
> From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> Sent: Wednesday, September 03, 2003 11:03 AM
> To: users@cocoon.apache.org
> Subject: RE: No "authentication" context?
> 
> 
> Do you have a snippet of code that does this?
> 
> Thanks,
> 
> 

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


RE: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
Do you have a snippet of code that does this?

Thanks,

Paul.

On Wed, 3 Sep 2003 11:02:11 +0200, Carsten Ziegeler wrote
> The correct way to get the session context is to use
> the context manager component from "org.apache.cocoon.webapps.session".
> 
> You have to lookup this component from the component manager,
> get the context from the context manager and can then stream
> the contents.
> 
> Carsten
> 
> > -----Original Message-----
> > From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> > Sent: Wednesday, September 03, 2003 10:50 AM
> > To: users@cocoon.apache.org; users@cocoon.apache.org
> > Subject: RE: No "authentication" context?
> >
> >
> > I have just come back from holiday and, upon downloading the new
> > 2.1 release, am having the same problem with some of
> > my components.
> >
> > For example, I have a very simple session generator that takes
> > the session data and throws it out as XML. The code
> > that does this is:
> >
> > SessionContext context = (SessionContext)
> > s.getAttribute("org.apache.cocoon.webapps.authentication.SessionContext");
> > context.streamXML("/global/authentication", super.contentHandler,
> > super.lexicalHandler);
> > ...
> >
> > As you can see, this takes the 'SessionContext' object that is
> > stored in the session and uses the 'streamXML' method
> > to pass the data as XML to the next component in the pipeline.
> >
> > Since the official 2.1 release the
> > 'org.apache.cocoon.webapps.authentication.SessionContext' session
> > object/attribute
> > has gone being replaced
> > with
> > 'org.apache.cocoon.webapps.authentication.components.DefaultAuthen
> > ticationManager/UserStatus'. This is a
> > different class and AFAICS is undocumented. ALL of my session
> > components no longer work.
> >
> > Can anyone explain why this change was made and how to access the
> > XML session data from within Java code.
> >
> > Many thanks,
> >
> > Paul.
> >
> >
> >
> >
> > On Wed, 3 Sep 2003 09:53:10 +0200, Carsten Ziegeler wrote
> > > Sonny Sukumar wrote:
> > > >
> > > >
> > > > 1.) Upon authentication, I store the user's email address in the
> > > > <ID> tag in
> > > > the doc the auth resource returns.
> > > > 2.) My assumption until this point has been that the "authentication"
> > > > context is now created in the session and stays there until
> > the user logs
> > > > out.  Furthemore, I've assumed that I should be able to fetch
> > the ID tag
> > > > contents at any time while the user is logged in (the email
> > > > address, in my
> > > > case).
> > > >
> > > Yes, that's absolutely correct.
> > >
> > > > I'm now using auth-protect with the correct handler in the
> > > > pipeline, but I
> > > > still get the same error--context "authentication" can't be found.
> > > >
> > > Without further information, I can only say that it should work
> > that way.
> > >
> > > You can have a look at the sample of the authentication block,
> > the protected
> > > pipeline there uses the session transformer to display the whole
> > > authentication
> > > context.
> > >
> > > Carsten
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> > --
> > Paul Bowler
> > Aventix Associates Ltd
> >
> > ---------------------------------------------------------------------
> > 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



--
Paul Bowler
Aventix Associates Ltd

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


RE: No "authentication" context?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
The correct way to get the session context is to use
the context manager component from "org.apache.cocoon.webapps.session".

You have to lookup this component from the component manager,
get the context from the context manager and can then stream
the contents.

Carsten

> -----Original Message-----
> From: Paul Bowler [mailto:paulbowler@www.aventix.co.uk]
> Sent: Wednesday, September 03, 2003 10:50 AM
> To: users@cocoon.apache.org; users@cocoon.apache.org
> Subject: RE: No "authentication" context?
>
>
> I have just come back from holiday and, upon downloading the new
> 2.1 release, am having the same problem with some of
> my components.
>
> For example, I have a very simple session generator that takes
> the session data and throws it out as XML. The code
> that does this is:
>
> SessionContext context = (SessionContext)
> s.getAttribute("org.apache.cocoon.webapps.authentication.SessionContext");
> context.streamXML("/global/authentication", super.contentHandler,
> super.lexicalHandler);
> ...
>
> As you can see, this takes the 'SessionContext' object that is
> stored in the session and uses the 'streamXML' method
> to pass the data as XML to the next component in the pipeline.
>
> Since the official 2.1 release the
> 'org.apache.cocoon.webapps.authentication.SessionContext' session
> object/attribute
> has gone being replaced
> with
> 'org.apache.cocoon.webapps.authentication.components.DefaultAuthen
> ticationManager/UserStatus'. This is a
> different class and AFAICS is undocumented. ALL of my session
> components no longer work.
>
> Can anyone explain why this change was made and how to access the
> XML session data from within Java code.
>
> Many thanks,
>
> Paul.
>
>
>
>
> On Wed, 3 Sep 2003 09:53:10 +0200, Carsten Ziegeler wrote
> > Sonny Sukumar wrote:
> > >
> > >
> > > 1.) Upon authentication, I store the user's email address in the
> > > <ID> tag in
> > > the doc the auth resource returns.
> > > 2.) My assumption until this point has been that the "authentication"
> > > context is now created in the session and stays there until
> the user logs
> > > out.  Furthemore, I've assumed that I should be able to fetch
> the ID tag
> > > contents at any time while the user is logged in (the email
> > > address, in my
> > > case).
> > >
> > Yes, that's absolutely correct.
> >
> > > I'm now using auth-protect with the correct handler in the
> > > pipeline, but I
> > > still get the same error--context "authentication" can't be found.
> > >
> > Without further information, I can only say that it should work
> that way.
> >
> > You can have a look at the sample of the authentication block,
> the protected
> > pipeline there uses the session transformer to display the whole
> > authentication
> > context.
> >
> > Carsten
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
> --
> Paul Bowler
> Aventix Associates Ltd
>
> ---------------------------------------------------------------------
> 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: No "authentication" context?

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
I have just come back from holiday and, upon downloading the new 2.1 release, am having the same problem with some of 
my components.

For example, I have a very simple session generator that takes the session data and throws it out as XML. The code 
that does this is:

SessionContext context = (SessionContext) s.getAttribute("org.apache.cocoon.webapps.authentication.SessionContext");
context.streamXML("/global/authentication", super.contentHandler, super.lexicalHandler);
...

As you can see, this takes the 'SessionContext' object that is stored in the session and uses the 'streamXML' method 
to pass the data as XML to the next component in the pipeline.

Since the official 2.1 release the 'org.apache.cocoon.webapps.authentication.SessionContext' session object/attribute 
has gone being replaced 
with 'org.apache.cocoon.webapps.authentication.components.DefaultAuthenticationManager/UserStatus'. This is a 
different class and AFAICS is undocumented. ALL of my session components no longer work.

Can anyone explain why this change was made and how to access the XML session data from within Java code.

Many thanks,

Paul.




On Wed, 3 Sep 2003 09:53:10 +0200, Carsten Ziegeler wrote
> Sonny Sukumar wrote:
> >
> >
> > 1.) Upon authentication, I store the user's email address in the
> > <ID> tag in
> > the doc the auth resource returns.
> > 2.) My assumption until this point has been that the "authentication"
> > context is now created in the session and stays there until the user logs
> > out.  Furthemore, I've assumed that I should be able to fetch the ID tag
> > contents at any time while the user is logged in (the email
> > address, in my
> > case).
> >
> Yes, that's absolutely correct.
> 
> > I'm now using auth-protect with the correct handler in the
> > pipeline, but I
> > still get the same error--context "authentication" can't be found.
> >
> Without further information, I can only say that it should work that way.
> 
> You can have a look at the sample of the authentication block, the protected
> pipeline there uses the session transformer to display the whole
> authentication
> context.
> 
> Carsten
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org



--
Paul Bowler
Aventix Associates Ltd

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