public class ApplicationSecurityContext extends Object
| Constructor and Description |
|---|
ApplicationSecurityContext(URL[] path,
URL entryPoint,
AppID appID)
Creates a new security context for an application whose code can
be found on the path supplied, and whose entry point directory is as given.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkPermission(Permission p)
Throws a
SecurityException if the requested
access, specified by the given permission, is not permitted
to the application or sub-application represented by this
application security context object. |
ApplicationSecurityContext |
createEmbeddedContext(URL[] path,
URL entryPoint)
Creates a context for an embedded part of an application, e.g.
|
Object |
doPrivileged(PrivilegedAction action)
Performs the specified PrivilegedAction with privileges enabled
and restricted by the specified AccessControlContext.
|
ClassLoader |
getClassLoader(String[] forbiddenPackages)
Get a classloader that is appropriate for loading classes for the
application (or sub-application) represented by this application
security context object.
|
URL |
getResource(String name,
boolean sameSigner)
Get a locator to the named resource, within the search path for this
application.
|
public ApplicationSecurityContext(URL[] path, URL entryPoint, AppID appID) throws IOException
If there is a permission request file in the directory identified by the entryPoint, it will be processed in the same way as the permission request file of a DVB-J application. i.e. reading it in, parsing it and taking account of the access rights granted by the user as defined under "General principles" in the main body of the present document.
path - The search path for locating resources within the application.entryPoint - The directory containing the permission request file to useappID - the application ID which the application is to run underIOException - when there is an IO error reading in the permission
request file or attempting to read in the permission request file or
attempting to discover the existence of a permission request file.NullPointerException - if entryPoint is null, if path is null,
or if any element of path is null.IllegalArgumentException - if path.length < 1public URL getResource(String name, boolean sameSigner)
Note (informative): This method can be used, for example, by an interoperable plug-in that needs to fetch part of an application that is not loaded by a classloader. For example, it could be used to get a locator to an HTML page, if and only if that page is appropriately signed.
name - The name of the resource (e.g. com/foo/MyPage.html)sameSigner - True if this is code, or any other resource for
which the signer must be the same as the signer
of the entry point.public ApplicationSecurityContext createEmbeddedContext(URL[] path, URL entryPoint)
path - The search path for locating resources within the application.entryPoint - The resource of the entry point of this application.NullPointerException - if entryPoint is null, if path is null,
or if any element of path is null.IllegalArgumentException - if path.length < 1public ClassLoader getClassLoader(String[] forbiddenPackages)
It is important that embedded DVB-J code be prevented from accessing classes that implement the plug-in application. To this end, the plug-in may specify a list of forbidden packages. Classes loaded by the returned classloader will be forbidden from loading or accessing classes in the named packages.
forbiddenPackages - a list of forbidden package names, e.g.
{ "de.tu-bs.ing.ifn.plugin.impl" }.public void checkPermission(Permission p)
SecurityException if the requested
access, specified by the given permission, is not permitted
to the application or sub-application represented by this
application security context object. The set of permissions
granted to an entity is be a function of receiver policy,
possibly influenced by user settings,
application signer, and permission request file.p - A permission object representing the resource for which
access is being checked.NullPointerException - if p is nullSecurityException - if this application has not been
granted access to the resource represented by p.public Object doPrivileged(PrivilegedAction action)
action - the action to be performed.Copyright © 2012 code4tv.com. All Rights Reserved.