Package org.apache.batik.util
Class ApplicationSecurityEnforcer
java.lang.Object
org.apache.batik.util.ApplicationSecurityEnforcer
This is a helper class which helps applications enforce secure
script execution.
It is used by the Squiggle browser as well as the rasterizer.
This class can install a
It is used by the Squiggle browser as well as the rasterizer.
This class can install a
SecurityManager
for an application
and resolves whether the application runs in a development
environment or from a jar file (in other words, it resolves code-base
issues for the application).
- Version:
- $Id: ApplicationSecurityEnforcer.java 1808888 2017-09-19 14:22:11Z ssteiner $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Directory where classes are expanded in the development versionprotected Class
The application's main entry pointprotected String
The resource name for the application's main classstatic final String
Message for the SecurityException thrown when there is already a SecurityManager installed at the time Squiggle tries to install its own security settings.static final String
Message for the NullPointerException thrown when no policy file can be found.static final String
Files in a jar file have a URL with the jar protocolstatic final String
Used in jar file urls to separate the jar file name from the referenced fileprotected BatikSecurityManager
Keeps track of the last SecurityManager installedstatic final String
System property for App's development base directorystatic final String
System property for App's jars base directorystatic final String
System property for specifying an additional policy file.protected String
The application's security policy -
Constructor Summary
ConstructorsConstructorDescriptionApplicationSecurityEnforcer
(Class appMainClass, String securityPolicy) Creates a new ApplicationSecurityEnforcer.ApplicationSecurityEnforcer
(Class appMainClass, String securityPolicy, String appJarFile) Deprecated.This constructor is now deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
enforceSecurity
(boolean enforce) Enforces security by installing aSecurityManager
.Returns the url for the default policy.void
Installs a SecurityManager on behalf of the applicationprivate void
setDevBase
(String expandedMainClassName) Position the app.dev.base property for expansion in the policy file used when App is running in its development versionprivate void
setJarBase
(String expandedMainClassName)
-
Field Details
-
EXCEPTION_ALIEN_SECURITY_MANAGER
Message for the SecurityException thrown when there is already a SecurityManager installed at the time Squiggle tries to install its own security settings.- See Also:
-
EXCEPTION_NO_POLICY_FILE
Message for the NullPointerException thrown when no policy file can be found.- See Also:
-
PROPERTY_JAVA_SECURITY_POLICY
System property for specifying an additional policy file.- See Also:
-
JAR_PROTOCOL
Files in a jar file have a URL with the jar protocol- See Also:
-
JAR_URL_FILE_SEPARATOR
Used in jar file urls to separate the jar file name from the referenced file- See Also:
-
PROPERTY_APP_DEV_BASE
System property for App's development base directory- See Also:
-
PROPERTY_APP_JAR_BASE
System property for App's jars base directory- See Also:
-
APP_MAIN_CLASS_DIR
Directory where classes are expanded in the development version- See Also:
-
appMainClass
The application's main entry point -
securityPolicy
The application's security policy -
appMainClassRelativeURL
The resource name for the application's main class -
lastSecurityManagerInstalled
Keeps track of the last SecurityManager installed
-
-
Constructor Details
-
ApplicationSecurityEnforcer
Deprecated.This constructor is now deprecated. Use the two argument constructor instead as this version will be removed after the 1.5beta4 release.Creates a new ApplicationSecurityEnforcer.- Parameters:
appMainClass
- class of the applications's main entry pointsecurityPolicy
- resource for the security policy which should be enforced for the application.appJarFile
- the Jar file into which the application is packaged.
-
ApplicationSecurityEnforcer
Creates a new ApplicationSecurityEnforcer.- Parameters:
appMainClass
- class of the applications's main entry pointsecurityPolicy
- resource for the security policy which should be enforced for the application.
-
-
Method Details
-
enforceSecurity
public void enforceSecurity(boolean enforce) Enforces security by installing aSecurityManager
. This will throw aSecurityException
if installing aSecurityManager
requires overriding an existingSecurityManager
. In other words, this method will not install a newSecurityManager
if there is already one it did not install in place. -
getPolicyURL
Returns the url for the default policy. This never returns null, but it may throw a NullPointerException -
installSecurityManager
public void installSecurityManager()Installs a SecurityManager on behalf of the application -
setJarBase
-
setDevBase
Position the app.dev.base property for expansion in the policy file used when App is running in its development version
-