CertyRush
Đang tải...
C CertyRush
Câu hỏi free preview

Câu 22: GSSP-Java: GIAC Secure Software Programmer-Java

Mark works as a Programmer for InfoTech Inc. He develops a class named Data that imports all the required packages. The class Data uses a method named PrintData(), which uses a method that checks whether the caller has a BeanUser security role. Which of the following code of the method PrintData() will satisfy the req…

Nội dung câu hỏi

Mark works as a Programmer for InfoTech Inc. He develops a class named Data that imports all the required packages. The class Data uses a method named PrintData(), which uses a method that checks whether the caller has a BeanUser security role. Which of the following code of the method PrintData() will satisfy the requirement?

Các lựa chọn

Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.

  1. A. public void PrintData(){@DeclareRoles("BeanUser")@Resource SessionContext ctx;@RolesAllowed("BeanUser")Principal caller = ctx.getCallerPrincipal();if (ctx.getCallerIdentity("BeanUser")) {System.out.println("It is the correct user");}else{System.out.println("It is the incorrect user");}//more code}
  2. B. public void PrintData(){@DeclareRoles("BeanUser")@Resource SessionContext ctx;@RolesAllowed("BeanUser")Principal caller = ctx.getEJBHome();if (!isCallerInRole(ctx)) {System.out.println("It is the correct user");} else{System.out.println("It is the incorrect user");}//more code}
  3. C. public void PrintData(){@DeclareRoles("BeanUser")@Resource SessionContext ctx;@RolesAllowed("BeanUser")Principal caller = ctx.getCallerPrincipal();if (ctx.isCallerInRole("BeanUser")) {System.out.println("It is the correct user");}else{System.out.println("It is the incorrect user");}//more code} — đáp án hiện tại
  4. D. public void PrintData(){@DeclareRoles("BeanUser")@Resource SessionContext ctx;@RolesAllowed("BeanUser")Principal caller = ctx.getCallerPrincipal();if (ctx.getStatus("BeanUser")) {System.out.println("It is the correct user");} else{System.out.println("It is the incorrect user");}//more code}

Cộng đồng

0 bình luận công khai. Tên thành viên được ẩn một phần.

Chưa có bình luận. Mở giao diện tương tác để bắt đầu thảo luận.

Câu hỏi liền kề