nerdexam
GIAC

GSSP-JAVA · Question #200

You work as a developer for PassGuide Inc. You have implemented a session bean with a method doPrint(), which behaves differently depending on the caller's security role. Only MANAGER in the…

The correct answer is A. Annotate method doPrint() with @RolesAllowed({"ADMIN","MANAGER"}). C. If EJBContext.isCallerInRole("ADMIN") returns true, implement the behavior defined for. See the full explanation below for the reasoning.

Question

You work as a developer for PassGuide Inc. You have implemented a session bean with a method doPrint(), which behaves differently depending on the caller's security role. Only MANAGER in the security roles "ADMIN" and "MANAGER" are allowed to call the method. Which of the following actions are appropriate to accomplish if there is no security-related metadata in the deployment descriptor? Each correct answer represents a complete solution. Choose all that apply.

Options

  • AAnnotate method doPrint() with @RolesAllowed({"ADMIN","MANAGER"}).
  • BAnnotate method doPrint() with @PermitAll.
  • CIf EJBContext.isCallerInRole("ADMIN") returns true, implement the behavior defined for
  • DIf EJBContext.getCallerPrincipal returns role "ADMIN", implement the behavior for

How the community answered

(25 responses)
  • A
    84% (21)
  • B
    4% (1)
  • D
    12% (3)

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice