private static synchronized PermissionCache createSecurityManagerCache() { Integer key = getNextKey(); PermissionCache cache = new PermissionCache(key, null, null, protoPerms, null); return registerPermissionCache(cache); }
private boolean checkConnectPermission() { if (cacheEnabled()) { return connectPerm.checkPermission(); } return false; }
public CachedPermissionImpl(PermissionCache c, Permission p) { this.permissionCache = c; this.permission = p; epoch = new Epoch(); }
public static String getContextID(WebBundleDescriptor wbd) { return SecurityUtil.getContextID(wbd); }
public static synchronized PermissionCache removePermissionCache(PermissionCache cache) { PermissionCache rvalue = null; if (cache != null) { Object value = cacheMap.remove(cache.getFactoryKey()); if (value != null && value instanceof PermissionCache) { rvalue = (PermissionCache) value; rvalue.reset(); } } return rvalue; }
private boolean checkProperty(String key) { if(key.equals("javax.net.ssl.keyStorePassword") || key.equals("javax.net.ssl.trustStorePassword")){ SSLUtils.checkPermission(key); } if (cacheEnabled()) { return cache.checkPermission(new PropertyPermission(key, "read")); } return false; }
public synchronized void enablePermissionCache(PermissionCache c) { if (c != null) { cache = c; connectPerm = new CachedPermissionImpl (cache, new SocketPermission("*","connect")); cacheEnabled = true; } }
public boolean checkPermission() { boolean granted = false; if (permissionCache != null) { granted = permissionCache.checkPermission(this.permission,this.epoch); } return granted; }
boolean checkPermission(Permission p, Epoch e) { return checkCache(p,e); }
@Override public void checkConnect(String host, int port) { if (checkConnectPermission()) { return; } super.checkConnect(host, port); }
@Override public void postConstruct() { onInitialization(); } }
/** * Register a PermissionCache object with the factory. If an object is * already registered at the key, it will be overidden. * @param cache a cache with an internal key value. * @return the cache object */ private static PermissionCache registerPermissionCache(PermissionCache cache) { cacheMap.put(cache.getFactoryKey(),cache); return cache; }
@Override public void checkPropertyAccess(String key) { if (checkProperty(key)) { return; } super.checkPropertyAccess(key); }
@Override public void checkAccess(ThreadGroup t) { super.checkAccess(t); checkPermission(new java.lang.RuntimePermission("modifyThreadGroup")); }
Integer key = getNextKey(); new PermissionCache(key, pcID, codesource, clazz, name); return registerPermissionCache(cache);
public static String getContextID(EjbDescriptor ejbDesc) { return SecurityUtil.getContextID(ejbDesc.getEjbBundleDescriptor()); }
public boolean permitAll(HttpServletRequest req) { boolean ret = false; WebResourcePermission webResPerm = createWebResourcePermission(req); if (uncheckedPermissionCache != null) { ret = uncheckedPermissionCache.checkPermission(webResPerm); } if (ret == false) { ret = checkPermissionWithoutCache(webResPerm, null); } return ret; }
public boolean checkPermission(Permission p) { return checkCache(p,null); }
@Override public void checkConnect(String host, int port, Object context) { if (checkConnectPermission()) { return; } super.checkConnect(host, port, context); }
Integer key = getNextKey(); new PermissionCache(key, pcID, codesource, perms, name); return registerPermissionCache(cache);