Package javax.security.jacc

Examples of javax.security.jacc.EJBMethodPermission


     */
    public void addPossibleEjbMethodPermissions(Permissions permissions, String ejbName, String methodInterface, Class clazz) throws OpenEJBException {
        if (clazz == null) return;
        for (java.lang.reflect.Method method : clazz.getMethods()) {
            String methodIface = ("LocalBean".equals(methodInterface) || "LocalBeanHome".equals(methodInterface)) ? null : methodInterface;
            permissions.add(new EJBMethodPermission(ejbName, methodIface, method));
        }
    }
View Full Code Here


            InterfaceType type = deploymentInfo.getInterfaceType(method.getDeclaringClass());

            String name = (type == null) ? null : type.getSpecName();

            Permission permission = new EJBMethodPermission(ejbName, name, method);

            AccessControlContext accessContext = ContextManager.getCurrentContext();

            if (permission != null) accessContext.checkPermission(permission);
View Full Code Here

        }

        // check if any security metadata was defined for the method.
        if (ejbMethodSecurityMetaData != null) {
            final MethodInterfaceType interfaceType = this.getMethodInterfaceType(ejbViewConfiguration.getMethodIntf());
            final EJBMethodPermission permission = new EJBMethodPermission(description.getEJBName(), methodIdentifier.getName(), interfaceType.name(), methodIdentifier.getParameterTypes());

            if (ejbMethodSecurityMetaData.isPermitAll()) {
                ejbJaccConfig.addPermit(permission);
            }
View Full Code Here

      Permissions uncheckedPermissions = null;
      Permissions excludedPermissions = null;
      HashMap rolePermissionsTable = null;

      EJBMethodPermission ejbmp = null;

      // phase 1
      Map mpMap = eDescriptor.getMethodPermissionsFromDD();
      if (mpMap != null) {

    Iterator mpIt = mpMap.keySet().iterator();

    while(mpIt.hasNext()) {

        MethodPermission mp = (MethodPermission)mpIt.next();

        Iterator mdIt = ((ArrayList) mpMap.get(mp)).iterator();

        while(mdIt.hasNext()) {

      MethodDescriptor md = (MethodDescriptor) mdIt.next();

      String mthdName = md.getName();
      String mthdIntf = md.getEjbClassSymbol();
      String mthdParams[] = md.getStyle() == 3 ?
          md.getParameterClassNames() : null;

      ejbmp = new EJBMethodPermission(eName,mthdName.equals("*") ?
              null : mthdName,
              mthdIntf,mthdParams);
      rolePermissionsTable =
          addToRolePermissionsTable(rolePermissionsTable,mp,ejbmp);

      uncheckedPermissions =
          addToUncheckedPermissions(uncheckedPermissions,mp,ejbmp);

      excludedPermissions =
          addToExcludedPermissions(excludedPermissions,mp,ejbmp);
        }
    }
      }

      // phase 2 - configures additional perms:
      //      . to optimize performance of Permissions.implies
      //      . to cause any uncovered methods to be unchecked

      Iterator mdIt = eDescriptor.getMethodDescriptors().iterator();
      while(mdIt.hasNext()) {

    MethodDescriptor md = (MethodDescriptor)mdIt.next();
    Method mthd = md.getMethod(eDescriptor);
    String mthdIntf = md.getEjbClassSymbol();

    if(mthd == null){
        continue;
    }

    if(mthdIntf == null || mthdIntf.equals("")) {
        _logger.severe("MethodDescriptor interface not defined - "+
           " ejbName: "+eName+
           " methodName: " +md.getName()+
           " methodParams: " +md.getParameterClassNames());
        continue;
    }

    ejbmp = new EJBMethodPermission(eName,mthdIntf,mthd);
 
    Iterator mpIt = eDescriptor.getMethodPermissionsFor(md).iterator();

    while(mpIt.hasNext()) {

View Full Code Here

  CachedPermission cp = null;
  Permission ejbmp = null;

  if (inv.invocationInfo == null || inv.invocationInfo.cachedPermission == null) {
      ejbmp = new EJBMethodPermission(ejbName,inv.getMethodInterface(),inv.method);
      cp = new CachedPermissionImpl(uncheckedMethodPermissionCache,ejbmp);
      if (inv.invocationInfo != null) {
    inv.invocationInfo.cachedPermission = cp;
    if (_logger.isLoggable(Level.FINE)){
        _logger.fine("JACC: permission initialized in InvocationInfo: EJBMethodPermission (Name) = "+ ejbmp.getName() + " (Action) = "+ ejbmp.getActions());
View Full Code Here

            InterfaceType type = deploymentInfo.getInterfaceType(method.getDeclaringClass());

            String name = (type == null)? null: type.getSpecName();

            Permission permission = new EJBMethodPermission(ejbName, name, method);

            if (permission != null) securityContext.acc.checkPermission(permission);

        } catch (AccessControlException e) {
            return false;
View Full Code Here

                } else {
                    methodParams = null;
                }

                // create the permission object
                EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams);
                notAssigned = cullPermissions(notAssigned, permission);

                // if this is unchecked, mark it as unchecked; otherwise assign the roles
                if (unchecked) {
                    uncheckedPermissions.add(permission);
                } else {
                    for (String roleName : roleNames) {
                        Permissions permissions = (Permissions) rolePermissions.get(roleName);
                        if (permissions == null) {
                            permissions = new Permissions();
                            rolePermissions.put(roleName, permissions);
                        }
                        permissions.add(permission);
                    }
                }
            }

        }

        /**
         * JACC v1.0 section 3.1.5.2
         */
        for (MethodInfo method : ejbJar.excludeList) {
            if (!ejbName.equals(method.ejbName)) {
                continue;
            }

            // method name
            String methodName = method.methodName;
            // method interface
            String methodIntf = method.methodIntf;

            // method parameters
            String[] methodParams;
            if (method.methodParams != null) {
                List<String> paramList = method.methodParams;
                methodParams = paramList.toArray(new String[paramList.size()]);
            } else {
                methodParams = null;
            }

            // create the permission object
            EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams);

            excludedPermissions.add(permission);
            notAssigned = cullPermissions(notAssigned, permission);
        }

View Full Code Here

     *          in case a class could not be found
     */
    public void addPossibleEjbMethodPermissions(Permissions permissions, String ejbName, String methodInterface, Class clazz) throws OpenEJBException {
        if (clazz == null) return;
        for (java.lang.reflect.Method method : clazz.getMethods()) {
            permissions.add(new EJBMethodPermission(ejbName, methodInterface, method));
        }
    }
View Full Code Here

            if (currentIdentity == null) {
                securityContext = threadContext.get(SecurityContext.class);
            } else {
                securityContext = new SecurityContext(currentIdentity.getSubject());
            }
            securityContext.acc.checkPermission(new EJBMethodPermission(ejbName, name, method));
        } catch (final AccessControlException e) {
            return false;
        }
        return true;
    }
View Full Code Here

                    } else {
                        methodParams = null;
                    }

                    // create the permission object
                    EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams);

                    excludedPermissions.add(permission);
                    allExcludedPermissions.addAll(intersectPermissions(notAssigned, permission, false));
                }
            }
            /**
             * JACC v1.0 section 3.1.5.1
             */
            for (MethodPermission methodPermission : assemblyDescriptor.getMethodPermission()) {
                List<String> roleNames = methodPermission.getRoleName();
                boolean unchecked = methodPermission.getUnchecked();

                for (Method method : methodPermission.getMethod()) {
                    if (!ejbName.equals(method.getEjbName())) {
                        continue;
                    }

                    // method name
                    String methodName = method.getMethodName();
                    if ("*".equals(methodName)) {
                        // jacc uses null instead of *
                        methodName = null;
                    }
                    // method interface
                    String methodIntf = method.getMethodIntf() == null? null: method.getMethodIntf().toString();

                    // method parameters
                    String[] methodParams;
                    if (method.getMethodParams() != null) {
                        List<String> paramList = method.getMethodParams().getMethodParam();
                        methodParams = paramList.toArray(new String[paramList.size()]);
                    } else {
                        methodParams = null;
                    }

                    // create the permission object
                    EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams);
                    Collection<Permission> culled = intersectPermissions(notAssigned, permission, true);
                    //does this intersect the excluded permissions?
                    int size = culled.size();
                    culled.removeAll(allExcludedPermissions);
                    if (size == culled.size()) {
View Full Code Here

TOP

Related Classes of javax.security.jacc.EJBMethodPermission

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.