The policy for a Java runtime (specifying
which permissions are available for code from various principals)
is represented as a separate
persistent configuration. The configuration may be stored as a
flat ASCII file, as a serialized binary file of
the Policy class, or as a database.
The Java runtime creates one global Policy object, which is used to
represent the static policy configuration file. It is consulted by
a ProtectionDomain when the protection domain initializes its set of
permissions.
The Policy init
method parses the policy
configuration file, and then
populates the Policy object. The Policy object is agnostic in that
it is not involved in making policy decisions. It is merely the
Java runtime representation of the persistent policy configuration
file.
When a protection domain needs to initialize its set of
permissions, it executes code such as the following
to ask the global Policy object to populate a
Permissions object with the appropriate permissions:
policy = Policy.getPolicy();
Permissions perms = policy.getPermissions(protectiondomain)
The protection domain contains a CodeSource
object, which encapsulates its codebase (URL) and public key attributes.
It also contains the principals associated with the domain.
The Policy object evaluates the global policy in light of whom the
principal is and what the code source is and returns an appropriate
Permissions object.
sun.security.provider
back to summary
pack-priv Class PolicyParser.DomainEntry
extends Object
- Class Inheritance
-
Each domain entry in the keystore domain configuration file is
represented by a DomainEntry object.
Constructor Summary
Access | Constructor and Description
|
---|
pack-priv |
|
Field Detail
name | back to summary
|
---|
private final String name
|
properties | back to summary
|
---|
private final Map<String, String> properties
|
Constructor Detail
DomainEntry | back to summary
|
---|
pack-priv DomainEntry(String name, Map<String, String> properties)
|
Method Detail
getName | back to summary
|
---|
pack-priv String getName()
|
getProperties | back to summary
|
---|
pack-priv Map<String, String> getProperties()
|
toString | back to summary
|
---|
public String toString() Overrides java.lang.Object.toString.
Doc from java.lang.Object.toString.
Returns a string representation of the object.
Satisfying this method's contract implies a non-null
result must be returned.
- Returns:String
a string representation of the object
- Annotations
- @Override
|
sun.security.provider
back to summary
public Class PolicyParser.GrantEntry
extends Object
- Class Inheritance
-
Each grant entry in the policy configuration file is
represented by a GrantEntry object.
For example, the entry
grant signedBy "Duke" {
permission java.io.FilePermission "/tmp", "read,write";
};
is represented internally
pe = new PermissionEntry("java.io.FilePermission",
"/tmp", "read,write");
ge = new GrantEntry("Duke", null);
ge.add(pe);
- Author
- Roland Schemers
version 1.19, 05/21/98
Constructor Summary
Access | Constructor and Description
|
---|
public |
|
public |
|
Field Detail
codeBase | back to summary
|
---|
public String codeBase
|
signedBy | back to summary
|
---|
public String signedBy
|
Constructor Detail
GrantEntry | back to summary
|
---|
public GrantEntry()
|
GrantEntry | back to summary
|
---|
public GrantEntry(String signedBy, String codeBase)
|
Method Detail
clone | back to summary
|
---|
public Object clone() Overrides java.lang.Object.clone.
Doc from java.lang.Object.clone.
Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object x , the expression:
x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true , but these are not absolute requirements.
While it is typically the case that:
x.clone().equals(x)
will be true , this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone . If a class and all of its superclasses (except
Object ) obey this convention, it will be the case that
x.clone().getClass() == x.getClass() .
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
- Returns:Object
a clone of this instance.
|
permissionElements | back to summary
|
---|
public Enumeration<PolicyParser.PermissionEntry> permissionElements() Enumerate all the permission entries in this GrantEntry.
|
write | back to summary
|
---|
public void write(PrintWriter out)
|
sun.security.provider
back to summary
pack-priv Class PolicyParser.KeyStoreEntry
extends Object
- Class Inheritance
-
Each keystore entry in the keystore domain configuration file is
represented by a KeyStoreEntry object.
Constructor Summary
Access | Constructor and Description
|
---|
pack-priv |
|
Field Detail
name | back to summary
|
---|
private final String name
|
properties | back to summary
|
---|
private final Map<String, String> properties
|
Constructor Detail
KeyStoreEntry | back to summary
|
---|
pack-priv KeyStoreEntry(String name, Map<String, String> properties)
|
Method Detail
getName | back to summary
|
---|
pack-priv String getName()
|
getProperties | back to summary
|
---|
pack-priv Map<String, String> getProperties()
|
toString | back to summary
|
---|
public String toString() Overrides java.lang.Object.toString.
Doc from java.lang.Object.toString.
Returns a string representation of the object.
Satisfying this method's contract implies a non-null
result must be returned.
- Returns:String
a string representation of the object
- Annotations
- @Override
|
sun.security.provider
back to summary
public Class PolicyParser.PermissionEntry
extends Object
- Class Inheritance
-
Each permission entry in the policy configuration file is
represented by a
PermissionEntry object.
For example, the entry
permission java.io.FilePermission "/tmp", "read,write";
is represented internally
pe = new PermissionEntry("java.io.FilePermission",
"/tmp", "read,write");
- Author
- Roland Schemers
version 1.19, 05/21/98
Constructor Summary
Access | Constructor and Description
|
---|
public |
|
public |
|
Method Summary
Modifier and Type | Method and Description
|
---|
public boolean |
|
public int |
|
public void |
|
- Inherited from java.lang.Object:
-
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait
Field Detail
action | back to summary
|
---|
public String action
|
permission | back to summary
|
---|
public String permission
|
signedBy | back to summary
|
---|
public String signedBy
|
Constructor Detail
PermissionEntry | back to summary
|
---|
public PermissionEntry()
|
PermissionEntry | back to summary
|
---|
public PermissionEntry(String permission, String name, String action)
|
Method Detail
equals | back to summary
|
---|
public boolean equals(Object obj) Overrides java.lang.Object.equals.
Doc from java.lang.Object.equals.
Indicates whether some other object is "equal to" this one.
The equals method implements an equivalence relation
on non-null object references:
- It is reflexive: for any non-null reference value
x , x.equals(x) should return
true .
- It is symmetric: for any non-null reference values
x and y , x.equals(y)
should return true if and only if
y.equals(x) returns true .
- It is transitive: for any non-null reference values
x , y , and z , if
x.equals(y) returns true and
y.equals(z) returns true , then
x.equals(z) should return true .
- It is consistent: for any non-null reference values
x and y , multiple invocations of
x.equals(y) consistently return true
or consistently return false , provided no
information used in equals comparisons on the
objects is modified.
- For any non-null reference value
x ,
x.equals(null) should return false .
An equivalence relation partitions the elements it operates on
into equivalence classes; all the members of an
equivalence class are equal to each other. Members of an
equivalence class are substitutable for each other, at least
for some purposes.
- Parameters
- obj:Object
the reference object with which to compare.
- Returns:boolean
true if this object is the same as the obj
argument; false otherwise.
- Annotations
- @Override
|
hashCode | back to summary
|
---|
public int hashCode() Overrides java.lang.Object.hashCode.
Calculates a hash code value for the object. Objects
which are equal will also have the same hashcode.
- Returns:int
Doc from java.lang.Object.hashCode.
a hash code value for this object
- Annotations
- @Override
|
write | back to summary
|
---|
public void write(PrintWriter out)
|
sun.security.provider
back to summary
public Class PolicyParser.PrincipalEntry
extends Object
implements Principal
- Class Inheritance
-
- All Implemented Interfaces
- java.security.Principal
Principal info (class and name) in a grant entry
Field Summary
Modifier and Type | Field and Description
|
---|
pack-priv String |
|
pack-priv String |
|
public static final String |
|
public static final String |
|
public static final String |
|
Constructor Summary
Access | Constructor and Description
|
---|
public | PrincipalEntry(String the Principal class principalClass, String the Principal name principalName)A PrincipalEntry consists of the Principal class and Principal name.
|
Method Summary
Modifier and Type | Method and Description
|
---|
public boolean |
|
public String |
|
public String |
|
public String |
|
public String |
|
public String |
|
public String |
|
public int |
|
pack-priv boolean |
|
pack-priv boolean |
|
pack-priv boolean |
|
public String |
|
public void |
|
- Inherited from java.lang.Object:
-
clonefinalizegetClassnotifynotifyAllwaitwaitwait
Field Detail
principalClass | back to summary
|
---|
pack-priv String principalClass
|
principalName | back to summary
|
---|
pack-priv String principalName
|
REPLACE_NAME | back to summary
|
---|
public static final String REPLACE_NAME
|
WILDCARD_CLASS | back to summary
|
---|
public static final String WILDCARD_CLASS
|
WILDCARD_NAME | back to summary
|
---|
public static final String WILDCARD_NAME
|
Constructor Detail
PrincipalEntry | back to summary
|
---|
public PrincipalEntry(String principalClass, String principalName) A PrincipalEntry consists of the Principal class and Principal name.
- Parameters
- principalClass:String
the Principal class
- principalName:String
the Principal name
- Exceptions
- NullPointerException:
- if principalClass or principalName are null
|
Method Detail
equals | back to summary
|
---|
public boolean equals(Object obj) Overrides java.lang.Object.equals.
Implements java.security.Principal.equals.
Test for equality between the specified object and this object.
Two PrincipalEntries are equal if their class and name values
are equal.
- Parameters
- obj:Object
the object to test for equality with this object
- Returns:boolean
true if the objects are equal, false otherwise
- Annotations
- @Override
|
getDisplayClass | back to summary
|
---|
public String getDisplayClass()
|
getDisplayName | back to summary
|
---|
public String getDisplayName()
|
getDisplayName | back to summary
|
---|
public String getDisplayName(boolean addQuote)
|
getName | back to summary
|
---|
public String getName() Implements java.security.Principal.getName.
Doc from java.security.Principal.getName.
Returns the name of this Principal .
- Returns:String
the name of this Principal .
- Annotations
- @Override
|
getPrincipalClass | back to summary
|
---|
public String getPrincipalClass()
|
getPrincipalName | back to summary
|
---|
public String getPrincipalName()
|
hashCode | back to summary
|
---|
public int hashCode() Overrides java.lang.Object.hashCode.
Implements java.security.Principal.hashCode.
Returns a hashcode for this PrincipalEntry.
- Returns:int
a hashcode for this PrincipalEntry
- Annotations
- @Override
|
isReplaceName | back to summary
|
---|
pack-priv boolean isReplaceName()
|
isWildcardClass | back to summary
|
---|
pack-priv boolean isWildcardClass()
|
isWildcardName | back to summary
|
---|
pack-priv boolean isWildcardName()
|
toString | back to summary
|
---|
public String toString() Overrides java.lang.Object.toString.
Implements java.security.Principal.toString.
Doc from java.security.Principal.toString.
Returns a string representation of this Principal .
- Returns:String
a string representation of this Principal .
- Annotations
- @Override
|
write | back to summary
|
---|
public void write(PrintWriter out)
|