Hi,

there is a getUserPrincipal() method in ExternalContext,

Regards
  Volker weber


Jeffrey Porter wrote:
>  
> 
> Hello again.
> 
>  
> 
> My question is this.
> 
>  
> 
> I want when a JSF page is displayed, to look up the current user and
> display some information on them.
> 
> For example…
> 
>  
> 
> *<%*
> 
> Principal principal = request.getUserPrincipal();
> 
>       String userName = principal.getName();
> 
>       User user = SomeUserManagementServerThing.loadUser(userName);
> 
> *%>*
> 
> * *
> 
> *<%=*userName*%>*
> 
> *<%=*user.isAdmin()*%>*
> 
>  
> 
> The above code is fine for the old JSP/Struts way of doing thing. But
> what is the approach I should take in MyFaces?
> 
>  
> 
> If the action method that makes the call to display the page knew about
> the Principle I could pass the User object in and all would be great.
> 
> But I don’t see a way for an action method to find out the currently
> logged in user.
> 
>  
> 
> What do you guys think? Is a there a paper / tutorial already on this
> that I’ve missed?
> 
>  
> 
> Thanks
> 
> Jeff
> 
>  
> 
> Using: JBoss 4.02, JAAS, DatabaseAuthentication
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to