Package javax.security.jacc

Examples of javax.security.jacc.EJBRoleRefPermission


        assert pc != null;
        if (pc != null) {
            String eName = eDescriptor.getName();
            for (RoleReference roleRef : eDescriptor.getRoleReferences()) {
                String rolename = roleRef.getRoleName();
                EJBRoleRefPermission ejbrr =
                        new EJBRoleRefPermission(eName, rolename);
                String rolelink = roleRef.getSecurityRoleLink().getName();

                pc.addToRole(rolelink, ejbrr);

                if (_logger.isLoggable(Level.FINE)) {
                    _logger.fine("JACC: Converting role-ref -> " + roleRef.toString() +
                            " to permission with name(" + ejbrr.getName() +
                            ") and actions (" + ejbrr.getActions() +
                            ")" + "mapped to role (" + rolelink + ")");
                }
            }
        }
    }
View Full Code Here


        if (_logger.isLoggable(Level.FINE)) {
            _logger.entering("EJBSecurityManager", "isCallerInRole", role);

        }
        EJBRoleRefPermission ejbrr = new EJBRoleRefPermission(ejbName, role);
       
        SecurityContext sc;
        if (runAs != null) {
            ComponentInvocation ci = invMgr.getCurrentInvocation();
            sc = (SecurityContext) ci.getOldSecurityContext();
        } else {
            sc = SecurityContext.getCurrent();
        }
        Set principalSet = null;
        if (sc != null) principalSet = sc.getPrincipalSet();

        ProtectionDomain prdm = getCachedProtectionDomain(principalSet, true);

        String oldContextId = null;
        try {
            // set the policy context in the TLS.
            oldContextId = setPolicyContext(this.contextId);
            ret = policy.implies(prdm, ejbrr);
        } catch (SecurityException se) {
            _logger.log(Level.SEVERE, "jacc_is_caller_in_role_exception", se);
            ret = false;
        } catch (Throwable t) {
            _logger.log(Level.SEVERE, "jacc_is_caller_in_role_exception", t);
            ret = false;
        } finally {
            try {
                resetPolicyContext(oldContextId, this.contextId);
            } catch (Throwable ex) {
                _logger.log(Level.SEVERE, "jacc_policy_context_exception", ex);
                ret = false;
            }
        }

        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("JACC: isCallerInRole Result: " + ret + " EJBRoleRefPermission (Name) = " + ejbrr.getName() + " (Action) = " + ejbrr.getActions() + " (Codesource) = " + prdm.getCodeSource());
        }

        return ret;
    }
View Full Code Here

   }
  
   private int checkRoleRef()
   {
      //This has to be the EJBRoleRefPermission 
      EJBRoleRefPermission ejbRoleRefPerm = new EJBRoleRefPermission(ejbName,roleName);
      boolean policyDecision = checkWithPolicy(ejbRoleRefPerm);
      if( policyDecision == false )
      {
         String msg = "Denied: "+ejbRoleRefPerm+", caller=" + callerSubject;
         if(trace)
View Full Code Here

        // of PolicyConfigurationFactory
        assert pc != null;
        String eName = eDescriptor.getName();
        for (RoleReference roleRef : eDescriptor.getRoleReferences()) {
            String rolename = roleRef.getRoleName();
            EJBRoleRefPermission ejbrr =
                    new EJBRoleRefPermission(eName, rolename);
            String rolelink = roleRef.getSecurityRoleLink().getName();

            pc.addToRole(rolelink, ejbrr);

            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("JACC: Converting role-ref -> " + roleRef.toString() +
                        " to permission with name(" + ejbrr.getName() +
                        ") and actions (" + ejbrr.getActions() +
                        ")" + "mapped to role (" + rolelink + ")");
            }
        }
    }
View Full Code Here

        assert pc != null;
        if (pc != null) {
            String eName = eDescriptor.getName();
            for (RoleReference roleRef : eDescriptor.getRoleReferences()) {
                String rolename = roleRef.getRoleName();
                EJBRoleRefPermission ejbrr =
                        new EJBRoleRefPermission(eName, rolename);
                String rolelink = roleRef.getSecurityRoleLink().getName();

                pc.addToRole(rolelink, ejbrr);

                if (_logger.isLoggable(Level.FINE)) {
                    _logger.fine("JACC: Converting role-ref -> " + roleRef.toString() +
                            " to permission with name(" + ejbrr.getName() +
                            ") and actions (" + ejbrr.getActions() +
                            ")" + "mapped to role (" + rolelink + ")");
                }
            }
        }
    }
View Full Code Here

        if (_logger.isLoggable(Level.FINE)) {
            _logger.entering("EJBSecurityManager", "isCallerInRole", role);

        }
        EJBRoleRefPermission ejbrr = new EJBRoleRefPermission(ejbName, role);
       
        SecurityContext sc;
        if (runAs != null) {
            ComponentInvocation ci = invMgr.getCurrentInvocation();
            sc = (SecurityContext) ci.getOldSecurityContext();
        } else {
            sc = SecurityContext.getCurrent();
        }

        Set principalSet = (sc != null) ? sc.getPrincipalSet() : null;
        ProtectionDomain prdm = getCachedProtectionDomain(principalSet, true);

        String oldContextId = null;
        try {
            // set the policy context in the TLS.
            oldContextId = setPolicyContext(this.contextId);
            ret = policy.implies(prdm, ejbrr);
        } catch (SecurityException se) {
            _logger.log(Level.SEVERE, "jacc_is_caller_in_role_exception", se);
            ret = false;
        } catch (Throwable t) {
            _logger.log(Level.SEVERE, "jacc_is_caller_in_role_exception", t);
            ret = false;
        } finally {
            try {
                resetPolicyContext(oldContextId, this.contextId);
            } catch (Throwable ex) {
                _logger.log(Level.SEVERE, "jacc_policy_context_exception", ex);
                ret = false;
            }
        }

        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("JACC: isCallerInRole Result: " + ret + " EJBRoleRefPermission (Name) = " + ejbrr.getName() + " (Action) = " + ejbrr.getActions() + " (Codesource) = " + prdm.getCodeSource());
        }

        return ret;
    }
View Full Code Here

                if (roleLinks == null) {
                    roleLinks = new Permissions();
                    rolePermissions.put(roleLink, roleLinks);

                }
                roleLinks.add(new EJBRoleRefPermission(ejbName, securityRoleRef.getRoleName()));
            }
        }

        /**
         * EJB v2.1 section 21.3.2
View Full Code Here

        String EJBName = deploymentInfo.getEjbName();
        if (EJBName == null) throw new IllegalArgumentException("EJBName must not be null");
        try {
            AccessControlContext context = ContextManager.getCurrentContext();
            context.checkPermission(new EJBRoleRefPermission(EJBName, role));
        } catch (AccessControlException e) {
            return false;
        }
        return true;
    }
View Full Code Here

   }
  
   private int checkRoleRef(Subject callerSubject, RoleGroup callerRoles)
   {
      //This has to be the EJBRoleRefPermission 
      EJBRoleRefPermission ejbRoleRefPerm = new EJBRoleRefPermission(ejbName,roleName);
      boolean policyDecision = checkWithPolicy(ejbRoleRefPerm, callerSubject, callerRoles);
      if( policyDecision == false )
      {
         String msg = "Denied: "+ejbRoleRefPerm+", caller=" + callerSubject;
         if(trace)
View Full Code Here

/*     */
/* 121 */     SecurityRoleRefsMetaData refs = bean.getSecurityRoleRefs();
/* 122 */     if (refs != null) {
/* 123 */       for (org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData ref : refs)
/*     */       {
/* 125 */         EJBRoleRefPermission p = new EJBRoleRefPermission(bean.getEjbName(), ref.getRoleName());
/* 126 */         pc.addToRole(ref.getRoleLink(), p);
/*     */       }
/*     */
/*     */     }
/*     */
View Full Code Here

TOP

Related Classes of javax.security.jacc.EJBRoleRefPermission

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.