Ejb3.0的安全访问

package com.easyway.tbs;
/**
 * ejb3.0 的安全的访问
 * @author longgangbai
 *
 */
public interface SecurityAccess {
 public String adminUserMethod();
 public String departmentMethod();
 public String annonymousUserMethod();
}

 

package com.easyway.tbs;

import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Remote;
import javax.ejb.Stateless;
/**
 * ejb3.0 的安全的访问
 * @author longgangbai
 *
 */
@Stateless
@Remote({SecurityAccess.class})
public class SecurityAccessBean  implements SecurityAccess{
 @RolesAllowed({"AdminUser"})
 public String adminUserMethod(){
  return "admin ";
 }
 
 @RolesAllowed({"DepartmentUser"})
 public String departmentMethod(){
  return "admin ";
 }
 @PermitAll
 public String annonymousUserMethod(){
  return "annonymousUser";
 }
}

你可能感兴趣的:(ejb,Security)