Refine search
static ModuleClassLoader getModuleClassLoader() throws ModuleLoadException { if (! WildFlySecurityManager.isChecking()) { return (ModuleClassLoader) SecurityActions.class.getClassLoader(); } else { return (ModuleClassLoader) doPrivileged(new GetClassLoaderAction(SecurityActions.class)); } }
/** * Build this context factory. * * @return the context factory */ public DirContextFactory build() { assertNotBuilt(); if (providerUrl == null) { throw log.noProviderUrlSet(); } if(this.targetModule != null){ this.targetClassLoader = doPrivileged(new GetModuleClassLoaderAction(this.targetModule)); } else { this.targetClassLoader = doPrivileged(new GetClassLoaderAction(this.getClass())); } built = true; return new SimpleDirContextFactory(); }
private ClassLoader driverClassLoader() { if(classLoader != null) { return classLoader; } final Class<? extends Driver> clazz = driverValue.getValue().getClass(); return ! WildFlySecurityManager.isChecking() ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
private static void checkPDPermission(Class<?> clazz, Permission permission) { final ProtectionDomain protectionDomain; final ClassLoader classLoader; if (getSecurityManager() instanceof WildFlySecurityManager) { protectionDomain = clazz.getProtectionDomain(); classLoader = clazz.getClassLoader(); } else { protectionDomain = doPrivileged(new GetProtectionDomainAction(clazz)); classLoader = doPrivileged(new GetClassLoaderAction(clazz)); } if (protectionDomain.implies(permission)) { return; } access.accessCheckFailed(permission, protectionDomain.getCodeSource(), classLoader); if (! LOG_ONLY) { throw access.accessControlException(permission, permission, protectionDomain.getCodeSource(), classLoader); } }
/** * Get the class loader for a class, doing a faster permission check that skips having to execute a privileged action * frame. * * @param clazz the class to check * @return the class loader */ public static ClassLoader getClassLoaderPrivileged(Class<?> clazz) { final SecurityManager sm = System.getSecurityManager(); if (sm == null) { return clazz.getClassLoader(); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return clazz.getClassLoader(); } ctx.checking = false; try { checkPDPermission(getCallerClass(2), GET_CLASS_LOADER_PERMISSION); return clazz.getClassLoader(); } finally { ctx.checking = true; } } else { checkPDPermission(getCallerClass(2), GET_CLASS_LOADER_PERMISSION); return doPrivileged(new GetClassLoaderAction(clazz)); } }
private static void checkEnvPropertyReadPermission(Class<?> clazz, String propertyName) { final ProtectionDomain protectionDomain; final ClassLoader classLoader; if (getSecurityManager() instanceof WildFlySecurityManager) { protectionDomain = clazz.getProtectionDomain(); classLoader = clazz.getClassLoader(); } else { protectionDomain = doPrivileged(new GetProtectionDomainAction(clazz)); classLoader = doPrivileged(new GetClassLoaderAction(clazz)); } if (protectionDomain.implies(ENVIRONMENT_PERMISSION)) { return; } final RuntimePermission permission = new RuntimePermission("getenv." + propertyName); if (protectionDomain.implies(permission)) { return; } access.accessCheckFailed(permission, protectionDomain.getCodeSource(), classLoader); if (! LOG_ONLY) { throw access.accessControlException(permission, permission, protectionDomain.getCodeSource(), classLoader); } }
private static void checkPropertyReadPermission(Class<?> clazz, String propertyName) { final ProtectionDomain protectionDomain; final ClassLoader classLoader; if (getSecurityManager() instanceof WildFlySecurityManager) { protectionDomain = clazz.getProtectionDomain(); classLoader = clazz.getClassLoader(); } else { protectionDomain = doPrivileged(new GetProtectionDomainAction(clazz)); classLoader = doPrivileged(new GetClassLoaderAction(clazz)); } if (protectionDomain.implies(PROPERTIES_PERMISSION)) { return; } final PropertyPermission permission = new PropertyPermission(propertyName, "read"); if (protectionDomain.implies(permission)) { return; } access.accessCheckFailed(permission, protectionDomain.getCodeSource(), classLoader); if (! LOG_ONLY) { throw access.accessControlException(permission, permission, protectionDomain.getCodeSource(), classLoader); } }
private static void checkPropertyWritePermission(Class<?> clazz, String propertyName) { final ProtectionDomain protectionDomain; final ClassLoader classLoader; if (getSecurityManager() instanceof WildFlySecurityManager) { protectionDomain = clazz.getProtectionDomain(); classLoader = clazz.getClassLoader(); } else { protectionDomain = doPrivileged(new GetProtectionDomainAction(clazz)); classLoader = doPrivileged(new GetClassLoaderAction(clazz)); } if (protectionDomain.implies(PROPERTIES_PERMISSION)) { return; } final PropertyPermission permission = new PropertyPermission(propertyName, "write"); if (protectionDomain.implies(permission)) { return; } access.accessCheckFailed(permission, protectionDomain.getCodeSource(), classLoader); if (! LOG_ONLY) { throw access.accessControlException(permission, permission, protectionDomain.getCodeSource(), classLoader); } }
final ClassLoader classLoader = WildFlySecurityManager.isChecking() ? doPrivileged(new GetClassLoaderAction(componentClass)) : componentClass.getClassLoader(); final String bdaId = beanManager.getId() + classLoader.hashCode(); type = transformer.getEnhancedAnnotatedType(clazz, bdaId);
this.activationSpec = activationSpec; this.activationName = activeResourceAdapterName + messageListenerInterface.getName(); final ClassLoader componentClassLoader = doPrivileged(new GetClassLoaderAction(ejbComponentCreateService.getComponentClass())); final MessageEndpointService<?> service = new MessageEndpointService<Object>() { @Override
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ClassLoader getClassLoader(final Class<?> clazz) { return getSecurityManager() == null ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); }
static ModuleClassLoader getModuleClassLoader() throws ModuleLoadException { if (! WildFlySecurityManager.isChecking()) { return (ModuleClassLoader) SecurityActions.class.getClassLoader(); } else { return (ModuleClassLoader) doPrivileged(new GetClassLoaderAction(SecurityActions.class)); } }