aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Getting the role of the prinicipal? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Getting the role of the prinicipal?" Watch "Getting the role of the prinicipal?" New topic
Author

Getting the role of the prinicipal?

Rowan John
Greenhorn

Joined: Oct 12, 2003
Posts: 14
Hi,
the javax.ejb.EntityContext interface defines the isCallerInRole(String) and getCallerPrincipal() methods. However, I need to know the callers role, how would I get this?

many thanks,
Rowan
Giselle Dazzi
Ranch Hand

Joined: Apr 20, 2003
Posts: 168
Hey, I had this same doubt once and somebody in another mailing list helped me with this:

>
>
> > Giselle,
> >
> > What you want is request.getUserPrincipal(). This will return a
> > java.security.Principal object. You can get the name by calling
> > getName() on that object.
> >
> > Unfortunately, you can't get the role or roles for the user. You have to
> > know the roles beforehand and then use request.isUserInRole to determine
> > wether they are or are not in a given role.
> >
> > -chris


Giselle Dazzi<br />SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the role of the prinicipal?
 
Similar Threads
Contradiction in servlet spec
Trouble Shooting Deployment
Problem While Enabling Authentication
Scrabble... it only takes a minute...
he doesn't ask for authenticate