nerdexam
Oracle

1Z0-860 · Question #230

A developer implements a session bean with a method doStuff which behaves differently depending on the caller's security role. Only users in security roles "ADMIN" and "USER" are allowed to call the…

The correct answer is B. Annotate method do Stuff with @RolesAllowed({"ADMIN","USER"}) D. If EJBContext.isCallerlnRole("ADMIN") returns true, implement the behavior defined for users in role. See the full explanation below for the reasoning.

Question

A developer implements a session bean with a method doStuff which behaves differently depending on the caller's security role. Only users in security roles "ADMIN" and "USER" are allowed to call the method. Assume that there is no security-related metadata in the deployment descriptor. Which two, taken in combination, are appropriate to accomplish this? (Choose two.)

Options

  • AAnnotate method do Stuff with @PermitAII.
  • BAnnotate method do Stuff with @RolesAllowed({"ADMIN","USER"})
  • CIf EJBContext.getCallerPrincipal returns role "ADMIN", implement the behavior for users in role ADMIN.
  • DIf EJBContext.isCallerlnRole("ADMIN") returns true, implement the behavior defined for users in role

How the community answered

(57 responses)
  • A
    5% (3)
  • B
    82% (47)
  • C
    12% (7)

Community Discussion

No community discussion yet for this question.

Full 1Z0-860 Practice