• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting the role of the prinicipal?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic