Class SecurityDesc
java.lang.Object
net.adoptopenjdk.icedteaweb.jnlp.element.security.SecurityDesc
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectAll permissions.private AppletPermissionLevelprivate ApplicationPermissionLevelprivate final Policyprivate final URLthe download hostprivate final JNLPFilethe JNLP fileprivate final booleanwhether sandbox applications should get the show window without banner permissionstatic final ObjectJ2EE permissions.private static final Permission[]basic permissions for restricted modeprivate static final Permission[]basic permissions for restricted modeprivate static final Loggerprivate static final Stringprivate static final Stringstatic final ObjectApplet permissions.private static final Permission[]basic permissions for restricted modestatic final Stringprivate Objectpermissions typeprivate static Class<Permission> URLPermission is new in Java 8, so we use reflection to check for it to keep compatibility with Java 6/7.private static Constructor<Permission> -
Constructor Summary
ConstructorsConstructorDescriptionSecurityDesc(JNLPFile file, AppletPermissionLevel appletPermissionLevel, Object type, URL downloadHost) Create a security descriptor.SecurityDesc(JNLPFile file, ApplicationPermissionLevel applicationPermissionLevel, Object type, URL downloadHost) Create a security descriptor. -
Method Summary
Modifier and TypeMethodDescription(package private) static StringappendRecursiveSubdirToCodebaseHostString(String codebaseHost) Appends a recursive access marker to a codebase host, for granting Java 8 URLPermissions which are no more restrictive than the existing SocketPermissions See http://docs.oracle.com/javase/8/docs/api/java/net/URLPermission.htmlprivate PolicyReturns a Policy object that represents a custom policy to use instead of grantingAllPermissionto aCodeSource(package private) static URIGets the host domain part of an applet's codebase.(package private) static URIgetHostWithSpecifiedPort(URI codebase, int port) Gets the host domain part of an applet's codebase.static String[]private Set<Permission>
-
Field Details
-
PROPERTY_READ_ACTION
- See Also:
-
PROPERTY_RW_ACTION
- See Also:
-
LOG
-
SECURITY_ELEMENT
- See Also:
-
applicationPermissionLevel
-
appletPermissionLevel
-
ALL_PERMISSIONS
All permissions. -
SANDBOX_PERMISSIONS
Applet permissions. -
J2EE_PERMISSIONS
J2EE permissions. -
type
permissions type -
downloadHost
the download host -
grantAwtPermissions
private final boolean grantAwtPermissionswhether sandbox applications should get the show window without banner permission -
file
the JNLP file -
customTrustedPolicy
-
urlPermissionClass
URLPermission is new in Java 8, so we use reflection to check for it to keep compatibility with Java 6/7. If we can't find the class or fail to construct it then we continue as usual without. These are saved as fields so that the reflective lookup only needs to be performed once when the SecurityDesc is constructed, rather than every time a call is made togetSandBoxPermissions(), which is called frequently. -
urlPermissionConstructor
-
j2eePermissions
basic permissions for restricted mode -
sandboxPermissions
basic permissions for restricted mode -
jnlpRIAPermissions
basic permissions for restricted mode- See Also:
-
-
Constructor Details
-
SecurityDesc
public SecurityDesc(JNLPFile file, ApplicationPermissionLevel applicationPermissionLevel, Object type, URL downloadHost) Create a security descriptor.- Parameters:
file- the JNLP fileapplicationPermissionLevel- the permissions specified in the JNLPtype- the type of securitydownloadHost- the download host (can always connect to)
-
SecurityDesc
public SecurityDesc(JNLPFile file, AppletPermissionLevel appletPermissionLevel, Object type, URL downloadHost) Create a security descriptor.- Parameters:
file- the JNLP fileappletPermissionLevel- the permissions specified in the JNLPtype- the type of securitydownloadHost- the download host (can always connect to)
-
-
Method Details
-
getCustomTrustedPolicy
Returns a Policy object that represents a custom policy to use instead of grantingAllPermissionto aCodeSource- Returns:
- a
Policyobject to delegate to. May be null, which indicates that no policy exists and AllPermissions should be granted instead.
-
getSecurityType
- Returns:
- the permissions type, one of: ALL, SANDBOX_PERMISSIONS, J2EE_PERMISSIONS.
-
getPermissions
- Parameters:
cs- the CodeSource to get permissions for- Returns:
- a PermissionCollection containing the basic permissions granted depending on the security type.
-
getApplicationPermissionLevel
-
getAppletPermissionLevel
-
getSandBoxPermissions
- Returns:
- a PermissionCollection containing the sandbox permissions
-
getUrlPermissions
-
getHostWithSpecifiedPort
Gets the host domain part of an applet's codebase. Removes path, query, and fragment, but preserves scheme, user info, and host. The port used is overridden with the specified port.- Parameters:
codebase- the applet codebase URLport-- Returns:
- the host domain of the codebase
- Throws:
URISyntaxException
-
getHost
Gets the host domain part of an applet's codebase. Removes path, query, and fragment, but preserves scheme, user info, host, and port.- Parameters:
codebase- the applet codebase URL- Returns:
- the host domain of the codebase
- Throws:
URISyntaxException
-
appendRecursiveSubdirToCodebaseHostString
Appends a recursive access marker to a codebase host, for granting Java 8 URLPermissions which are no more restrictive than the existing SocketPermissions See http://docs.oracle.com/javase/8/docs/api/java/net/URLPermission.html- Parameters:
codebaseHost- the applet's codebase's host domain URL as a String. Expected to be formatted as eg "http://example.com:8080" or "http://example.com/"- Returns:
- the resulting String eg "http://example.com:8080/-
-
getJnlpRIAPermissions
- Returns:
- all the names of the basic JNLP system properties accessible by RIAs
-