package x;

import java.net.URL;
import java.net.URLClassLoader;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Permissions;

public class PrivilegedURLClassLoader extends URLClassLoader {

	Permissions perms;
	
	public PrivilegedURLClassLoader(URL[] aurl, ClassLoader classloader) {
		super(aurl, classloader);
		init();
	}

	public PrivilegedURLClassLoader(URL[] aurl) {
		super(aurl);
		init();
	}
	
	private void init() {
		perms = new Permissions();
		perms.add(new AllPermission());
	}

	@Override
	protected PermissionCollection getPermissions(CodeSource codesource) {
		return perms;
	}

}
