Complete the code to secure the method so only users with role 'ADMIN' can access it.
@Secured({"[1]"})
public void adminOnlyMethod() {
// method logic
}The @Secured annotation requires roles to be prefixed with 'ROLE_'. So to allow only admins, use 'ROLE_ADMIN'.
Complete the code to allow access to users with either 'USER' or 'ADMIN' roles.
@Secured({"[1]", "ROLE_ADMIN"})
public void userOrAdminMethod() {
// method logic
}To allow multiple roles, list them in @Secured. Roles must have 'ROLE_' prefix, so use 'ROLE_USER' and 'ROLE_ADMIN'.
Fix the error in the annotation to correctly secure the method for 'MANAGER' role.
@Secured("[1]") public void managerMethod() { // method logic }
@Secured expects a string or array of strings with roles prefixed by 'ROLE_'. Use "ROLE_MANAGER" as a string.
Fill both blanks to secure the method for roles 'ADMIN' and 'SUPERVISOR'.
@Secured({"[1]", "[2]"})
public void adminSupervisorMethod() {
// method logic
}Use the @Secured annotation with an array of roles, each prefixed by 'ROLE_'.
Fill all three blanks to secure the method for roles 'USER', 'ADMIN', and 'GUEST'.
@Secured({"[1]", "[2]", "[3]"})
public void multiRoleMethod() {
// method logic
}List all roles with 'ROLE_' prefix inside the @Secured annotation array.