Package org.jboss.security.authorization.resources

Examples of org.jboss.security.authorization.resources.EJBResource


   public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
     
      this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
     
      this.roleName = (String)map.get(ResourceKeys.ROLENAME);
      this.roleRefCheck = (Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK);
     
      this.callerRunAs = ejbResource.getCallerRunAsIdentity();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.ejbName = ejbResource.getEjbName();
      this.ejbPrincipal = ejbResource.getPrincipal();
      this.methodInterface = ejbResource.getEjbMethodInterface();
      this.methodRoles = ejbResource.getEjbMethodRoles();
      this.securityRoleReferences = ejbResource.getSecurityRoleReferences();
      this.ejbRestrictions = ejbResource.isEnforceEJBRestrictions();
     
      if(this.roleRefCheck == Boolean.TRUE)
         return checkRoleRef(role);
      else
         return process(role);
View Full Code Here


   public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");

      this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
     
      this.ejbCS = ejbResource.getCodeSource();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.ejbName = ejbResource.getEjbName();
      this.methodInterface = ejbResource.getEjbMethodInterface();
     
      //isCallerInRole checks
      this.roleName = (String)map.get(ResourceKeys.ROLENAME);
     
      this.roleRefCheck = (Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK);
View Full Code Here

   public int authorize(Resource resource)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
   
      AuthorizationManager am = (AuthorizationManager) map.get("authorizationManager");
      if(am == null)
         throw new IllegalStateException("Authorization Manager is null");
      if(am instanceof PolicyRegistration)
         this.policyRegistration = (PolicyRegistration) am;
     
      //Populate local variables from the resource
      /*this.callerSubject = (Subject)map.get(ResourceKeys.CALLER_SUBJECT);
      this.ejbCS = (CodeSource)map.get(ResourceKeys.EJB_CODESOURCE);
      this.ejbMethod = (Method)map.get(ResourceKeys.EJB_METHOD);
      this.ejbName = (String)map.get(ResourceKeys.EJB_NAME);
      this.methodInterface = (String)map.get(ResourceKeys.EJB_METHODINTERFACE);*/
     
     
      this.callerSubject = ejbResource.getCallerSubject();
      this.ejbCS = ejbResource.getCodeSource();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.ejbName = ejbResource.getEjbName();
      this.methodInterface = ejbResource.getEjbMethodInterface();
     
      this.roleName = (String)map.get(ResourceKeys.ROLENAME);
      //Get the Security Context Roles
      if(am != null)
      {
View Full Code Here

   public int authorize(Resource resource)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
    
      AuthorizationManager am = (AuthorizationManager) map.get("authorizationManager");
      if(am == null)
         throw new IllegalStateException("Authorization Manager is null");
      if(am instanceof PolicyRegistration)
         this.policyRegistration = (PolicyRegistration) am;
      //Populate local variables from the resource
      /*this.ejbName = (String)map.get(ResourceKeys.EJB_NAME);
      this.ejbMethod = (Method)map.get(ResourceKeys.EJB_METHOD);
      this.principal = (Principal)map.get(ResourceKeys.EJB_PRINCIPAL);*/
     
      this.ejbName = ejbResource.getEjbName();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.principal = ejbResource.getPrincipal();
     
      Boolean roleRefCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK));
      if(roleRefCheck)
         throw new IllegalStateException("SECURIY-50:Role Ref checks not implemented");
     
View Full Code Here

   public int authorize(Resource resource)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");

      AuthorizationManager am = (AuthorizationManager) map.get("authorizationManager");
      if(am == null)
         throw new IllegalStateException("Authorization Manager is null");
      if(am instanceof PolicyRegistration)
         this.policyRegistration = (PolicyRegistration) am;
      //Populate local variables from the resource
      /*this.ejbMethod = (Method)map.get(ResourceKeys.EJB_METHOD);
      this.ejbName = (String)map.get(ResourceKeys.EJB_NAME);
      this.ejbPrincipal = (Principal)map.get(ResourceKeys.EJB_PRINCIPAL);
      this.methodInterface = (String)map.get(ResourceKeys.EJB_METHODINTERFACE);
      this.methodRoles = (Set)map.get(ResourceKeys.EJB_METHODROLES);
      this.callerRunAsIdentity = (RunAsIdentity)map.get(ResourceKeys.RUNASIDENTITY);
      this.securityRoleReferences = (Set)map.get(ResourceKeys.SECURITY_ROLE_REFERENCES);
      */
      this.roleName = (String)map.get(ResourceKeys.ROLENAME);
      this.roleRefCheck = (Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK);
     
      this.callerRunAs = ejbResource.getCallerRunAsIdentity();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.ejbName = ejbResource.getEjbName();
      this.ejbPrincipal = ejbResource.getPrincipal();
      this.methodInterface = ejbResource.getEjbMethodInterface();
      this.methodRoles = ejbResource.getMethodRoles();
      this.securityRoleReferences = ejbResource.getSecurityRoleReferences();
     
      if(this.roleRefCheck == Boolean.TRUE)
         return checkRoleRef();
      else
         return process();
View Full Code Here

      }

      public int authorize(Resource resource, Subject subject, RoleGroup role) throws AuthorizationException
      {
         log.debug("authorize " + resource + " " + subject + " " + role);
         EJBResource ejbResource = (EJBResource) resource;
         RoleGroup methodRoles = ejbResource.getEjbMethodRoles();
         if(methodRoles == null)
            return AuthorizationContext.PERMIT;
         if(methodRoles.containsRole(SimpleRole.ANYBODY_ROLE))
            return AuthorizationContext.PERMIT;
         for(Principal p : subject.getPrincipals())
View Full Code Here

   public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
   {
      if(resource instanceof EJBResource == false)
         throw new IllegalArgumentException("resource is not an EJBResource");
     
      EJBResource ejbResource = (EJBResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");

      this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
     
      this.ejbCS = ejbResource.getCodeSource();
      this.ejbMethod = ejbResource.getEjbMethod();
      this.ejbName = ejbResource.getEjbName();
      this.methodInterface = ejbResource.getEjbMethodInterface();
     
      this.roleName = (String)map.get(ResourceKeys.ROLENAME);
     
      this.roleRefCheck = (Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK);
      if(this.roleRefCheck == Boolean.TRUE)
View Full Code Here

/*     */   public int authorize(Resource resource)
/*     */   {
/*  68 */     if (!(resource instanceof EJBResource)) {
/*  69 */       throw new IllegalArgumentException("resource is not an EJBResource");
/*     */     }
/*  71 */     EJBResource ejbResource = (EJBResource)resource;
/*     */
/*  74 */     Map map = resource.getMap();
/*  75 */     if (map == null) {
/*  76 */       throw new IllegalStateException("Map from the Resource is null");
/*     */     }
/*  78 */     AuthorizationManager am = (AuthorizationManager)map.get("authorizationManager");
/*  79 */     if (am == null)
/*  80 */       throw new IllegalStateException("Authorization Manager is null");
/*  81 */     if ((am instanceof PolicyRegistration)) {
/*  82 */       this.policyRegistration = ((PolicyRegistration)am);
/*     */     }
/*     */
/*  88 */     this.ejbName = ejbResource.getEjbName();
/*  89 */     this.ejbMethod = ejbResource.getEjbMethod();
/*  90 */     this.principal = ejbResource.getPrincipal();
/*     */
/*  92 */     Boolean roleRefCheck = checkBooleanValue((Boolean)map.get("roleRefPermissionCheck"));
/*  93 */     if (roleRefCheck.booleanValue()) {
/*  94 */       throw new IllegalStateException("SECURIY-50:Role Ref checks not implemented");
/*     */     }
View Full Code Here

/*     */   public int authorize(Resource resource)
/*     */   {
/*  78 */     if (!(resource instanceof EJBResource)) {
/*  79 */       throw new IllegalArgumentException("resource is not an EJBResource");
/*     */     }
/*  81 */     EJBResource ejbResource = (EJBResource)resource;
/*     */
/*  84 */     Map map = resource.getMap();
/*  85 */     if (map == null) {
/*  86 */       throw new IllegalStateException("Map from the Resource is null");
/*     */     }
/*  88 */     AuthorizationManager am = (AuthorizationManager)map.get("authorizationManager");
/*  89 */     if (am == null)
/*  90 */       throw new IllegalStateException("Authorization Manager is null");
/*  91 */     if ((am instanceof PolicyRegistration)) {
/*  92 */       this.policyRegistration = ((PolicyRegistration)am);
/*     */     }
/*     */
/* 102 */     this.roleName = ((String)map.get("roleName"));
/* 103 */     this.roleRefCheck = ((Boolean)map.get("roleRefPermissionCheck"));
/*     */
/* 105 */     this.callerRunAs = ejbResource.getCallerRunAsIdentity();
/* 106 */     this.ejbMethod = ejbResource.getEjbMethod();
/* 107 */     this.ejbName = ejbResource.getEjbName();
/* 108 */     this.ejbPrincipal = ejbResource.getPrincipal();
/* 109 */     this.methodInterface = ejbResource.getEjbMethodInterface();
/* 110 */     this.methodRoles = ejbResource.getMethodRoles();
/* 111 */     this.securityRoleReferences = ejbResource.getSecurityRoleReferences();
/*     */
/* 113 */     if (this.roleRefCheck == Boolean.TRUE) {
/* 114 */       return checkRoleRef();
/*     */     }
/* 116 */     return process();
View Full Code Here

/*  78 */     AuthorizationManager am = this.securityContext.getAuthorizationManager();
/*     */
/*  80 */     HashMap map = new HashMap();
/*  81 */     map.put("authorizationManager", am);
/*     */
/*  83 */     EJBResource ejbResource = new EJBResource(map);
/*  84 */     ejbResource.setCallerRunAsIdentity(callerRunAs);
/*  85 */     ejbResource.setEjbName(ejbName);
/*  86 */     ejbResource.setEjbMethod(ejbMethod);
/*  87 */     ejbResource.setPrincipal(ejbPrincipal);
/*  88 */     ejbResource.setEjbMethodInterface(invocationInterfaceString);
/*  89 */     ejbResource.setCodeSource(ejbCS);
/*  90 */     ejbResource.setCallerRunAsIdentity(callerRunAs);
/*  91 */     ejbResource.setCallerSubject(callerSubject);
/*  92 */     ejbResource.setMethodRoles(methodRoles);
/*     */
/*  94 */     boolean isAuthorized = false;
/*     */     try
/*     */     {
/*  97 */       int check = am.authorize(ejbResource);
View Full Code Here

TOP

Related Classes of org.jboss.security.authorization.resources.EJBResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.