cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: Cocoon Authentication: Getting the User object after logging in
Date Sat, 24 May 2008 14:18:04 GMT
Magnus Haraldsen Amundsen schrieb:
> Using Cocoon 2.2 RC2 and the Cocoon Authentication block.
> 
>  
> 
> First the sitemap uses
> 
>  
> 
> <map:act type="cauth-is-logged-in">
> 
>     <map:parameter name="application" value="Sublima"/>
> 
>     […]
> 
> </map:act>
> 
> <map:redirect-to uri="{request:contextPath}/login"/>
> 
>  
> 
> To check if the user is logged in.
> 
>  
> 
> The user logs in and we use a Java class that extends 
> AbstractSecurityHandler to do the username/password check and that 
> returns a User object.
> 
> We can set additional attributes to this User object using 
> User.setAttribute(key, value) and we want to do this to control which 
> role the user has.
> 
>  
> 
> In the other Java code we use the ApplicationManager to see if the user 
> is logged in, by calling ApplicationManager.isLoggedIn(“Sublima”).
> 
>  
> 
> How do we get the User object that were created upon login? We can’t 
> find any methods in ApplicationManager that returns User.
> 
Have a look at the ApplicationUtil class. If you have access to the 
objectModel map (don't know how to get this in 2.2), you can use the 
static methods. If not, create an instance of the ApplicationUtil class 
and call getUser().

HTH
Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

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


Mime
View raw message