• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Why doesn't EJBContext offer a method like getCallerRole to obtain the caller's role?

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJBContext has isCallerInRole() and getCallerPrincipal(), but how could I get the caller's role?
[ December 17, 2008: Message edited by: Mellon Sun ]
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how could I get the caller's role?

You can recover it through evaluating isCallerInRole: Though not very elegant, but works.
 
Mellon Sun
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a method to get all the roles?
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there a method to get all the roles?


No. Moreover you have to declare each role you want to use in isCallerInRole in the @DeclareRoles annotation. If you use a different one you'll get an error.
[ December 17, 2008: Message edited by: Ralph Jaus ]
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to add:

To my understanding the EJB role model goes in the other direction: First, the bean provider defines appropriate roles for his or her application. Then he or she specifies which role is allowed to use which business methods (@RolesAllowed) or how the business logic depends on the role of the caller (isCallerInRole).

In this point of view there is no need to determine the possible roles in a business method.

But my understanding may be a little bit limited. Interesting topic anyway.
[ December 17, 2008: Message edited by: Ralph Jaus ]
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic