Search in sources :

Example 66 with PermissionCollection

use of java.security.PermissionCollection in project Payara by payara.

the class EarEEPermissionsProcessor method convertEEPermissionPaths.

// conver the path for permissions
private void convertEEPermissionPaths(CommponentType cmpType) throws MalformedURLException {
    // get server suppled default policy
    PermissionCollection defWarPc = SMGlobalPolicyUtil.getEECompGrantededPerms(cmpType);
    // revise the filepermission's path
    PermissionCollection eePc = processPermisssonsForPath(defWarPc, context);
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Revised permissions = " + eePc);
    }
    compTypeToEEGarntsMap.put(cmpType, eePc);
}
Also used : PermissionCollection(java.security.PermissionCollection)

Example 67 with PermissionCollection

use of java.security.PermissionCollection in project Payara by payara.

the class SMGlobalPolicyUtil method checkRestrictionOfEar.

// for ear type, check evrything
public static void checkRestrictionOfEar(PermissionCollection declaredPC) throws SecurityException {
    PermissionCollection pc = compTypeToEERestrictedMap.get(CommponentType.ejb);
    if (pc != null)
        SMGlobalPolicyUtil.checkRestriction(declaredPC, pc);
    pc = compTypeToEERestrictedMap.get(CommponentType.war);
    if (pc != null)
        SMGlobalPolicyUtil.checkRestriction(declaredPC, pc);
    pc = compTypeToEERestrictedMap.get(CommponentType.rar);
    if (pc != null)
        SMGlobalPolicyUtil.checkRestriction(declaredPC, pc);
    pc = compTypeToEERestrictedMap.get(CommponentType.car);
    if (pc != null)
        SMGlobalPolicyUtil.checkRestriction(declaredPC, pc);
}
Also used : PermissionCollection(java.security.PermissionCollection)

Example 68 with PermissionCollection

use of java.security.PermissionCollection in project Payara by payara.

the class SMGlobalPolicyUtil method checkRestrictionOfComponentType.

/**
 * Check a permission set against a restriction of a component type
 *
 * @param declaredPC
 * @param type
 * @return
 * @throws SecurityException
 */
public static void checkRestrictionOfComponentType(PermissionCollection declaredPC, CommponentType type) throws SecurityException {
    if (CommponentType.ear == type)
        checkRestrictionOfEar(declaredPC);
    PermissionCollection restrictedPC = compTypeToEERestrictedMap.get(type);
    checkRestriction(declaredPC, restrictedPC);
}
Also used : PermissionCollection(java.security.PermissionCollection)

Example 69 with PermissionCollection

use of java.security.PermissionCollection in project Payara by payara.

the class PermsArchiveDelegate method processEEPermissions.

/**
 * Get the EE permissions for the spcified module type
 *
 * @param type module type
 * @param dc the deployment context
 * @return the ee permissions
 */
public static PermissionCollection processEEPermissions(SMGlobalPolicyUtil.CommponentType type, DeploymentContext dc) {
    ModuleEEPermissionsProcessor eePp = new ModuleEEPermissionsProcessor(type, dc);
    PermissionCollection eePc = eePp.getAdjustedEEPermission();
    return eePc;
}
Also used : PermissionCollection(java.security.PermissionCollection)

Example 70 with PermissionCollection

use of java.security.PermissionCollection in project Payara by payara.

the class PermsArchiveDelegate method processModuleDeclaredAndEEPemirssions.

/**
 * Get the declared permissions and EE permissions, then add them to the classloader
 *
 * @param type module type
 * @param context deployment context
 * @param classloader throws AccessControlException if caller has no privilege
 */
public static void processModuleDeclaredAndEEPemirssions(SMGlobalPolicyUtil.CommponentType type, DeploymentContext context, ClassLoader classloader) throws SecurityException {
    if (System.getSecurityManager() != null) {
        if (!(classloader instanceof DDPermissionsLoader))
            return;
        if (!(context instanceof ExtendedDeploymentContext))
            return;
        DDPermissionsLoader ddcl = (DDPermissionsLoader) classloader;
        if (((ExtendedDeploymentContext) context).getParentContext() == null) {
            PermissionCollection declPc = getDeclaredPermissions(type, context);
            ddcl.addDeclaredPermissions(declPc);
        }
        PermissionCollection eePc = processEEPermissions(type, context);
        ddcl.addEEPermissions(eePc);
    }
}
Also used : PermissionCollection(java.security.PermissionCollection) DDPermissionsLoader(com.sun.enterprise.security.integration.DDPermissionsLoader) ExtendedDeploymentContext(org.glassfish.internal.deployment.ExtendedDeploymentContext)

Aggregations

PermissionCollection (java.security.PermissionCollection)107 Permission (java.security.Permission)39 Permissions (java.security.Permissions)29 CodeSource (java.security.CodeSource)25 FilePermission (java.io.FilePermission)20 ProtectionDomain (java.security.ProtectionDomain)19 AllPermission (java.security.AllPermission)16 Policy (java.security.Policy)15 URL (java.net.URL)14 File (java.io.File)10 IOException (java.io.IOException)10 Certificate (java.security.cert.Certificate)8 AccessControlContext (java.security.AccessControlContext)7 PropertyPermission (java.util.PropertyPermission)7 Test (org.junit.Test)7 SocketPermission (java.net.SocketPermission)6 Method (java.lang.reflect.Method)5 Principal (java.security.Principal)5 PrivilegedActionException (java.security.PrivilegedActionException)5 URLClassLoader (java.net.URLClassLoader)4