Which java code snippet roles “MANAGER” and “EMPLOYEE” in a given application?

Which java code snippet roles “MANAGER” and “EMPLOYEE” in a given application?
@DeclareRole(“EMPLOYEE”)
public class MyServlet extends HttpServlet {}

Which java code snippet roles “MANAGER” and “EMPLOYEE” in a given application?
@DeclareRole(“EMPLOYEE”)
public class MyServlet extends HttpServlet {}

A.
@DeclareRoles({ “MANAGER”, “EMPLOYEE” })public class MyServlet extends HttpServlet {}

B.
@SecurityRoles({ “MANAGER”, “EMPLOYEE” })public class MyServlet extends HttpServlet {}

C.
@DeclareRoles(“MANAGER”)@DeclareRoles(“EMPLOYEE”)public class MyServlet extends
HttpServlet {}

D.
@DeclareRole(“MANAGER”)

Explanation:
* The syntax for declaring more than one role is as shown in the following example:
@DeclareRoles({“Administrator”, “Manager”, “Employee”})
* @DeclareRoles
This annotation declares the security roles defined by the application.
* javax.annotation.security
Annotation Type DeclareRoles

@Documented
@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface DeclareRoles
Used by application to declare roles. It can be specified on a class.



Leave a Reply 1

Your email address will not be published. Required fields are marked *