gioni wrote:
Christoph Hermann wrote:

Hello,

on some pages i want to display a login-form wheter the User is logged in or not.
Therefore i need to know if the User is logged in. Is there a way i can do this when the page i server is not enclosed in a <map:act type="auth-protect">
?


I tried
${cocoon.session.getAttribute("org.apache.cocoon.webapps.session.context.SessionContext").get("authentication").getValueOfNode( "authentication/ID")} and ${cocoon.session.getAttribute("org.apache.cocoon.webapps.session.context.SessionContext").get("authentication").getValueOfNode( "ID")} (found this with google) but none of these work.



These two lines will only work inside the "auth-protect" action because only then a sessioncontext named "authentication" is available. Whenever that action fails, the user is not logged in and the authentication handler mechanism will redirect you to a login page.


Are you aiming at a site where you can log in on every page and show more info/pages if you are logged in? You might want to consider using a guest user/role so that everyone visiting the site is automatically logged in, but with restrictions attached to that "role/user" (so show login form if id/role is guest/guest) and only when logging in as a real user/role more options/pages are available.

Do check if you're satisfied with the authentication framework and see if it 
suits your needs:
 http://cocoon.apache.org/2.1/developing/webapps/authentication.html
, remember that the framework isn't the perfect solution for every problem.

Kind Regards,
Jan



I use the contaioner authentication (with tomcat or jetty), and get the username in the flowscript simple using cocoon.request.getRemoteUser() this return the username when is called.

Bye Gioni


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to