• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

@DeclareRoles vs @RolesAllowed

Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am preparing for SCBCD5 exam and have some doubts about these annotations.

I have good knowledge about security in older version of EJBs. But finding it hard to understand in EJB3.

RolesAllowed annotation is used to declare logical roles instead of declaring them in the deployment descriptor?

What is the use of DeclareRoles annotation? is it also used to declare new logical role name ?e.g.

or used to refer the name used programmatically in ejb?


in the above code i have declared two roles "employee","manager" but the code itself uses only one role.So the container will create a new role called employee which is equivalent to <security-role><role-name>employee</role-name></security-role>?

i got the above question as i was going through the specification and it says :

The set of security roles used by the application is taken to be the aggregation of the security roles defined by the security role names used in the DeclareRoles and RolesAllowed annotations. The Bean Provider may augment the set of security roles defined for the application by annotations in this way by means of the security-role deployment descriptor element.


You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic