Top Description Inners Fields Constructors Methods
sun.security.provider

public Class PolicyFile

extends Policy
Class Inheritance
Annotations
@SuppressWarnings:removal
Imports
java.io.*, java.lang.reflect.*, java.net.MalformedURLException, .URL, .URI, .SocketPermission, .NetPermission, java.nio.file.Files, .Path, java.util.*, java.security.*, java.security.cert.Certificate, .X509Certificate, javax.security.auth.Subject, javax.security.auth.x500.X500Principal, java.util.concurrent.ConcurrentHashMap, jdk.internal.access.JavaSecurityAccess, .SharedSecrets, jdk.internal.util.StaticProperty, sun.nio.fs.DefaultFileSystemProvider, sun.security.util.*, sun.net.www.ParseUtil

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

This class represents a default Policy implementation for the "JavaPolicy" type.

This object stores the policy for the entire Java runtime, and is the amalgamation of multiple static policy configurations that resides in files. The algorithm for locating the policy file(s) and reading their information into this Policy object is:

  1. Read in and load the default policy file named <JAVA_HOME>/lib/security/default.policy. <JAVA_HOME> refers to the value of the java.home system property, and specifies the directory where the JRE is installed. This policy file grants permissions to the modules loaded by the platform class loader. If the default policy file cannot be loaded, a fatal InternalError is thrown as these permissions are needed in order for the runtime to operate correctly.
  2. Loop through the java.security.Security properties, and policy.url.1, policy.url.2, ..., policy.url.X". These properties are set in the Java security properties file, which is located in the file named <JAVA_HOME>/conf/security/java.security. Each property value specifies a URL pointing to a policy file to be loaded. Read in and load each policy. If none of these could be loaded, use a builtin static policy equivalent to the conf/security/java.policy file.
  3. The java.lang.System property java.security.policy may also be set to a URL pointing to another policy file (which is the case when a user uses the -D switch at runtime). If this property is defined, and its use is allowed by the security property file (the Security property, policy.allowSystemProperty is set to true), also load that policy. If the java.security.policy property is defined using "==" (rather than "="), then load the specified policy file and ignore all other configured policies. Note, that the default.policy file is also loaded, as specified in the first step of the algorithm above. If the specified policy file cannot be loaded, use a builtin static policy equivalent to the default conf/security/java.policy file.
Each policy file consists of one or more grant entries, each of which consists of a number of permission entries.
  grant signedBy "alias", codeBase "URL",
        principal principalClass "principalName",
        principal principalClass "principalName",
        ... {

    permission Type "name "action",
        signedBy "alias";
    permission Type "name "action",
        signedBy "alias";
    ....
  };
All non-bold items above must appear as is (although case doesn't matter and some are optional, as noted below). principal entries are optional and need not be present. Italicized items represent variable values.

A grant entry must begin with the word grant. The signedBy,codeBase and principal name/value pairs are optional. If they are not present, then any signer (including unsigned code) will match, and any codeBase will match. Note that the principalClass may be set to the wildcard value, *, which allows it to match any Principal class. In addition, the principalName may also be set to the wildcard value, *, allowing it to match any Principal name. When setting the principalName to the *, do not surround the * with quotes.

A permission entry must begin with the word permission. The word Type in the template above is a specific permission type, such as java.io.FilePermission or java.lang.RuntimePermission.

The "action" is required for many permission types, such as java.io.FilePermission (where it specifies what type of file access that is permitted). It is not required for categories such as java.lang.RuntimePermission where it is not necessary - you either have the permission specified by the "name" value following the type name or you don't.

The signedBy name/value pair for a permission entry is optional. If present, it indicates a signed permission. That is, the permission class itself must be signed by the given alias in order for it to be granted. For example, suppose you have the following grant entry:

  grant principal foo.com.Principal "Duke" {
    permission Foo "foobar", signedBy "FooSoft";
  }

Then this permission of type Foo is granted if the Foo.class permission has been signed by the "FooSoft" alias, or if XXX Foo.class is a system class (i.e., is found on the CLASSPATH).

Items that appear in an entry must appear in the specified order (permission, Type, "name", and "action"). An entry is terminated with a semicolon.

Case is unimportant for the identifiers (permission, signedBy, codeBase, etc.) but is significant for the Type or for any string that is passed in as a value.

An example of two entries in a policy configuration file is

  // if the code is comes from "foo.com" and is running as "Duke",
  // grant it read/write to all files in /tmp.

  grant codeBase "foo.com", principal foo.com.Principal "Duke" {
             permission java.io.FilePermission "/tmp/*", "read,write";
  };

  // grant any code running as "Duke" permission to read
  // the "java.vendor" Property.

  grant principal foo.com.Principal "Duke" {
        permission java.util.PropertyPermission "java.vendor";


This Policy implementation supports special handling of any permission that contains the string, "${{self}}", as part of its target name. When such a permission is evaluated (such as during a security check), ${{self}} is replaced with one or more Principal class/name pairs. The exact replacement performed depends upon the contents of the grant clause to which the permission belongs.

If the grant clause does not contain any principal information, the permission will be ignored (permissions containing ${{self}} in their target names are only valid in the context of a principal-based grant clause). For example, BarPermission will always be ignored in the following grant clause:

   grant codebase "www.foo.com", signedby "duke" {
     permission BarPermission "... ${{self}} ...";
   };
If the grant clause contains principal information, ${{self}} will be replaced with that same principal information. For example, ${{self}} in BarPermission will be replaced by javax.security.auth.x500.X500Principal "cn=Duke" in the following grant clause:
   grant principal javax.security.auth.x500.X500Principal "cn=Duke" {
     permission BarPermission "... ${{self}} ...";
   };
 
If there is a comma-separated list of principals in the grant clause, then ${{self}} will be replaced by the same comma-separated list or principals. In the case where both the principal class and name are wildcarded in the grant clause, ${{self}} is replaced with all the principals associated with the Subject in the current AccessControlContext.

For PrivateCredentialPermissions, you can also use "self" instead of "${{self}}". However the use of "self" is deprecated in favour of "${{self}}".

See Also
java.security.CodeSource, java.security.Permissions, java.security.ProtectionDomain

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
PolicyFile.PolicyEntry

Each entry in the policy configuration file is represented by a PolicyEntry object.

private static class
PolicyFile.PolicyInfo

holds policy information that we need to synch on

private static class

Field Summary

Modifier and TypeField and Description
private boolean
private static Set<URL>
badPolicyURLs

When a policy file has a syntax error, the exception code may generate another permission check and this can cause the policy file to be parsed repeatedly, leading to a StackOverflowError or ClassCircularityError.

private static final FileSystem
builtInFS

Use the platform's default file system to avoid recursive initialization issues when the VM is configured to use a custom file system provider.

private static final Debug
private static final int
private boolean
private boolean
private static final Class<?>[]
private static final Class<?>[]
private static final Class<?>[]
private static final String
private static final String
private volatile PolicyFile.PolicyInfo
private static final String
private URL
private static final String
Inherited from java.security.Policy:
UNSUPPORTED_EMPTY_COLLECTION

Constructor Summary

AccessConstructor and Description
public
PolicyFile()

Initializes the Policy object and reads the default policy configuration file(s) into the Policy object.

public
PolicyFile(URL url)

Initializes the Policy object and reads the default policy from the specified URL only.

Method Summary

Modifier and TypeMethod and Description
private void
addGrantEntry(PolicyParser.GrantEntry ge, KeyStore keyStore, PolicyFile.PolicyInfo newInfo)

Add one policy entry to the list.

private void
addPermissions(Permissions perms, final CodeSource cs, Principal[] principals, final PolicyFile.PolicyEntry entry)

private void
private CodeSource
canonicalizeCodebase(CodeSource cs, boolean extractSignerCerts)

private static String
private void
private void
expandSelf(PolicyFile.SelfPermission
the SelfPermission that needs to be expanded.
sp
,
List<PolicyParser.PrincipalEntry>
list of principals for the Policy entry.
entryPs
,
Principal[]
Principal array from the current ProtectionDomain.
pdp
,
Permissions
the PermissionCollection where the individual Permissions will be added after expansion.
perms
)

private Certificate[]
getCertificates(KeyStore keyStore, String aliases, PolicyFile.PolicyInfo newInfo)

Fetch all certs associated with this alias.

private CodeSource

Returns:

null if signedBy alias is not recognized
getCodeSource
(PolicyParser.GrantEntry ge, KeyStore keyStore, PolicyFile.PolicyInfo newInfo)

Given a GrantEntry, create a codeSource.

private String
getDN(String alias, KeyStore keystore)

private InputStreamReader
private static final Permission
getInstance(String
the type of Permission being created.
type
,
String
the name of the Permission being created.
name
,
String
the actions of the Permission being created.
actions
)

Returns a new Permission object of the given Type.

private static Permission
getKnownPermission(Class<?> claz, String name, String actions)

Creates one of the well-known permissions in the java.base module directly instead of via reflection.

private static Principal
getKnownPrincipal(Class<?> claz, String name)

Creates one of the well-known principals in the java.base module directly instead of via reflection.

public PermissionCollection

Returns:

the Permissions granted to the provided ProtectionDomain.
getPermissions
(ProtectionDomain
the Permissions granted to this ProtectionDomain are returned.
domain
)

Overrides java.security.Policy.getPermissions.

Examines this Policy and returns the permissions granted to the specified ProtectionDomain.

public PermissionCollection

Returns:

the set of permissions according to the policy.
getPermissions
(CodeSource
the CodeSource associated with the caller. This encapsulates the original location of the code (where the code came from) and the public key(s) of its signer.
codesource
)

Overrides java.security.Policy.getPermissions.

Examines this Policy and creates a PermissionCollection object with the set of permissions for the specified CodeSource.

private PermissionCollection

Returns:

the set of Permissions according to the policy.
getPermissions
(Permissions
the Permissions to populate
perms
,
ProtectionDomain
the ProtectionDomain associated with the caller.
pd
)

Examines the global policy and returns the provided Permissions object with additional permissions granted to the specified ProtectionDomain.

private PermissionCollection

Returns:

the set of permissions according to the policy.
getPermissions
(Permissions
the permissions to populate
perms
,
final CodeSource
the codesource associated with the caller. This encapsulates the original location of the code (where the code came from) and the public key(s) of its signer.
cs
)

Examines the global policy and returns the provided Permissions object with additional permissions granted to the specified CodeSource.

private Permissions
getPermissions(Permissions perms, final CodeSource cs, Principal[] principals)

private String[][]
getPrincipalInfo(PolicyParser.PrincipalEntry pe, Principal[] pdp)

return the principal class/name pair in the 2D array.

protected Certificate[]
public boolean

Returns:

true if "permission" is a proper subset of a permission granted to this ProtectionDomain.
implies
(ProtectionDomain
the ProtectionDomain to test
pd
,
Permission
the Permission object to be tested for implication.
p
)

Overrides java.security.Policy.implies.

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

private void
init(URL url)

Initializes the Policy object and reads the default policy configuration file(s) into the Policy object.

private boolean
init(URL policy, PolicyFile.PolicyInfo newInfo)

Reads a policy configuration into the Policy object using a Reader object.

private void
private void
initPolicyFile(final PolicyFile.PolicyInfo newInfo, final URL url)

private boolean
initPolicyFile(final String propname, final String urlname, final PolicyFile.PolicyInfo newInfo)

private void
private static URL
newURL(String spec)

private String
public void
refresh()

Overrides java.security.Policy.refresh.

Refreshes the policy object by re-reading all the policy files.

private boolean
replacePrincipals(List<PolicyParser.PrincipalEntry> principals, KeyStore keystore)

return true if no replacement was performed, or if replacement succeeded.

private static boolean
wildcardPrincipalNameImplies(String principalClass, Principal[] principals)

Returns true if the array of principals contains at least one principal of the specified class.

Inherited from java.security.Policy:
getInstancegetInstancegetInstancegetParametersgetPolicygetProvidergetTypesetPolicy

Field Detail

allowSystemPropertiesback to summary
private boolean allowSystemProperties
badPolicyURLsback to summary
private static Set<URL> badPolicyURLs

When a policy file has a syntax error, the exception code may generate another permission check and this can cause the policy file to be parsed repeatedly, leading to a StackOverflowError or ClassCircularityError. To avoid this, this set is populated with policy files that have been previously parsed and have syntax errors, so that they can be subsequently ignored.

builtInFSback to summary
private static final FileSystem builtInFS

Use the platform's default file system to avoid recursive initialization issues when the VM is configured to use a custom file system provider.

debugback to summary
private static final Debug debug

Hides java.security.Policy.debug.

DEFAULT_CACHE_SIZEback to summary
private static final int DEFAULT_CACHE_SIZE
expandPropertiesback to summary
private boolean expandProperties
notUtf8back to summary
private boolean notUtf8
PARAMS0back to summary
private static final Class<?>[] PARAMS0
PARAMS1back to summary
private static final Class<?>[] PARAMS1
PARAMS2back to summary
private static final Class<?>[] PARAMS2
POLICYback to summary
private static final String POLICY
POLICY_URLback to summary
private static final String POLICY_URL
policyInfoback to summary
private volatile PolicyFile.PolicyInfo policyInfo

Hides java.security.Policy.policyInfo.

SELFback to summary
private static final String SELF
urlback to summary
private URL url
X500PRINCIPALback to summary
private static final String X500PRINCIPAL

Constructor Detail

PolicyFileback to summary
public PolicyFile()

Initializes the Policy object and reads the default policy configuration file(s) into the Policy object.

PolicyFileback to summary
public PolicyFile(URL url)

Initializes the Policy object and reads the default policy from the specified URL only.

Method Detail

addGrantEntryback to summary
private void addGrantEntry(PolicyParser.GrantEntry ge, KeyStore keyStore, PolicyFile.PolicyInfo newInfo)

Add one policy entry to the list.

addPermissionsback to summary
private void addPermissions(Permissions perms, final CodeSource cs, Principal[] principals, final PolicyFile.PolicyEntry entry)
addPermsback to summary
private void addPerms(Permissions perms, Principal[] accPs, PolicyFile.PolicyEntry entry)
canonicalizeCodebaseback to summary
private CodeSource canonicalizeCodebase(CodeSource cs, boolean extractSignerCerts)
canonPathback to summary
private static String canonPath(String path) throws IOException
expandPermissionNameback to summary
private void expandPermissionName(PolicyParser.PermissionEntry pe, KeyStore keystore) throws Exception
expandSelfback to summary
private void expandSelf(PolicyFile.SelfPermission sp, List<PolicyParser.PrincipalEntry> entryPs, Principal[] pdp, Permissions perms)
Parameters
sp:PolicyFile.SelfPermission

the SelfPermission that needs to be expanded.

entryPs:List<PolicyParser.PrincipalEntry>

list of principals for the Policy entry.

pdp:Principal[]

Principal array from the current ProtectionDomain.

perms:Permissions

the PermissionCollection where the individual Permissions will be added after expansion.

getCertificatesback to summary
private Certificate[] getCertificates(KeyStore keyStore, String aliases, PolicyFile.PolicyInfo newInfo)

Fetch all certs associated with this alias.

getCodeSourceback to summary
private CodeSource getCodeSource(PolicyParser.GrantEntry ge, KeyStore keyStore, PolicyFile.PolicyInfo newInfo) throws MalformedURLException

Given a GrantEntry, create a codeSource.

Returns:CodeSource

null if signedBy alias is not recognized

getDNback to summary
private String getDN(String alias, KeyStore keystore)
getInputStreamReaderback to summary
private InputStreamReader getInputStreamReader(InputStream is)
getInstanceback to summary
private static final Permission getInstance(String type, String name, String actions) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException

Returns a new Permission object of the given Type. The Permission is created by getting the Class object using the Class.forName method, and using the reflection API to invoke the (String name, String actions) constructor on the object.

Parameters
type:String

the type of Permission being created.

name:String

the name of the Permission being created.

actions:String

the actions of the Permission being created.

Exceptions
ClassNotFoundException:
if the particular Permission class could not be found.
InstantiationException:
if getInstance tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.
IllegalAccessException:
if the class or initializer is not accessible.
NoSuchMethodException:
if the (String, String) constructor is not found.
InvocationTargetException:
if the underlying Permission constructor throws an exception.
getKnownPermissionback to summary
private static Permission getKnownPermission(Class<?> claz, String name, String actions)

Creates one of the well-known permissions in the java.base module directly instead of via reflection. Keep list short to not penalize permissions from other modules.

getKnownPrincipalback to summary
private static Principal getKnownPrincipal(Class<?> claz, String name)

Creates one of the well-known principals in the java.base module directly instead of via reflection. Keep list short to not penalize principals from other modules.

getPermissionsback to summary
public PermissionCollection getPermissions(ProtectionDomain domain)

Overrides java.security.Policy.getPermissions.

Examines this Policy and returns the permissions granted to the specified ProtectionDomain. This includes the permissions currently associated with the domain as well as the policy permissions granted to the domain's CodeSource, ClassLoader, and Principals.

Note that this Policy implementation has special handling for PrivateCredentialPermissions. When this method encounters a PrivateCredentialPermission which specifies "self" as the Principal class and name, it does not add that Permission to the returned PermissionCollection. Instead, it builds a new PrivateCredentialPermission for each Principal associated with the provided Subject. Each new PrivateCredentialPermission contains the same Credential class as specified in the originally granted permission, as well as the Class and name for the respective Principal.

Parameters
domain:ProtectionDomain

the Permissions granted to this ProtectionDomain are returned.

Returns:PermissionCollection

the Permissions granted to the provided ProtectionDomain.

Annotations
@Override
getPermissionsback to summary
public PermissionCollection getPermissions(CodeSource codesource)

Overrides java.security.Policy.getPermissions.

Examines this Policy and creates a PermissionCollection object with the set of permissions for the specified CodeSource.

Parameters
codesource:CodeSource

the CodeSource associated with the caller. This encapsulates the original location of the code (where the code came from) and the public key(s) of its signer.

Returns:PermissionCollection

the set of permissions according to the policy.

Annotations
@Override
getPermissionsback to summary
private PermissionCollection getPermissions(Permissions perms, ProtectionDomain pd)

Examines the global policy and returns the provided Permissions object with additional permissions granted to the specified ProtectionDomain.

Parameters
perms:Permissions

the Permissions to populate

pd:ProtectionDomain

the ProtectionDomain associated with the caller.

Returns:PermissionCollection

the set of Permissions according to the policy.

getPermissionsback to summary
private PermissionCollection getPermissions(Permissions perms, final CodeSource cs)

Examines the global policy and returns the provided Permissions object with additional permissions granted to the specified CodeSource.

Parameters
perms:Permissions

the permissions to populate

cs:CodeSource

the codesource associated with the caller. This encapsulates the original location of the code (where the code came from) and the public key(s) of its signer.

Returns:PermissionCollection

the set of permissions according to the policy.

getPermissionsback to summary
private Permissions getPermissions(Permissions perms, final CodeSource cs, Principal[] principals)
getPrincipalInfoback to summary
private String[][] getPrincipalInfo(PolicyParser.PrincipalEntry pe, Principal[] pdp)

return the principal class/name pair in the 2D array. array[x][y]: x corresponds to the array length. if (y == 0), it's the principal class. if (y == 1), it's the principal name.

getSignerCertificatesback to summary
protected Certificate[] getSignerCertificates(CodeSource cs)
impliesback to summary
public boolean implies(ProtectionDomain pd, Permission p)

Overrides java.security.Policy.implies.

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

Parameters
pd:ProtectionDomain

the ProtectionDomain to test

p:Permission

the Permission object to be tested for implication.

Returns:boolean

true if "permission" is a proper subset of a permission granted to this ProtectionDomain.

Annotations
@Override
See Also
java.security.ProtectionDomain
initback to summary
private void init(URL url)

Initializes the Policy object and reads the default policy configuration file(s) into the Policy object. See the class description for details on the algorithm used to initialize the Policy object.

initback to summary
private boolean init(URL policy, PolicyFile.PolicyInfo newInfo)

Reads a policy configuration into the Policy object using a Reader object.

initDefaultPolicyback to summary
private void initDefaultPolicy(PolicyFile.PolicyInfo newInfo)
initPolicyFileback to summary
private void initPolicyFile(final PolicyFile.PolicyInfo newInfo, final URL url)
initPolicyFileback to summary
private boolean initPolicyFile(final String propname, final String urlname, final PolicyFile.PolicyInfo newInfo)
initStaticPolicyback to summary
private void initStaticPolicy(final PolicyFile.PolicyInfo newInfo)
newURLback to summary
private static URL newURL(String spec) throws MalformedURLException
Annotations
@SuppressWarnings:deprecation
printPDback to summary
private String printPD(ProtectionDomain pd)
refreshback to summary
public void refresh()

Overrides java.security.Policy.refresh.

Refreshes the policy object by re-reading all the policy files.

Annotations
@Override
replacePrincipalsback to summary
private boolean replacePrincipals(List<PolicyParser.PrincipalEntry> principals, KeyStore keystore)

return true if no replacement was performed, or if replacement succeeded.

wildcardPrincipalNameImpliesback to summary
private static boolean wildcardPrincipalNameImplies(String principalClass, Principal[] principals)

Returns true if the array of principals contains at least one principal of the specified class.

sun.security.provider back to summary

private Class PolicyFile.PolicyEntry

extends Object
Class Inheritance

Each entry in the policy configuration file is represented by a PolicyEntry object.

A PolicyEntry is a (CodeSource,Permission) pair. The CodeSource contains the (URL, PublicKey) that together identify where the Java bytecodes come from and who (if anyone) signed them. The URL could refer to localhost. The URL could also be null, meaning that this policy entry is given to all comers, as long as they match the signer field. The signer could be null, meaning the code is not signed.

The Permission contains the (Type, Name, Action) triplet.

For now, the Policy object retrieves the public key from the X.509 certificate on disk that corresponds to the signedBy alias specified in the Policy config file. For reasons of efficiency, the Policy object keeps a hashtable of certs already read in. This could be replaced by a secure internal key store.

For example, the entry

         permission java.io.File "/tmp", "read,write",
         signedBy "Duke";
is represented internally

FilePermission f = new FilePermission("/tmp", "read,write");
PublicKey p = publickeys.get("Duke");
URL u = InetAddress.getLocalHost();
CodeBase c = new CodeBase( p, u );
pe = new PolicyEntry(f, c);
Authors
Marianne Mueller, Roland Schemers
See Also
java.security.CodeSource, java.security.Policy, java.security.Permissions, java.security.ProtectionDomain

Field Summary

Modifier and TypeField and Description
private final CodeSource
pack-priv final List<Permission>
private final List<PolicyParser.PrincipalEntry>

Constructor Summary

AccessConstructor and Description
pack-priv
PolicyEntry(CodeSource
the CodeSource, which encapsulates the URL and the public key attributes from the policy config file. Validity checks are performed on the public key before PolicyEntry is called.
cs
,
List<PolicyParser.PrincipalEntry> principals)

Given a Permission and a CodeSource, create a policy entry.

pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
add(Permission p)

add a Permission object to this entry.

pack-priv CodeSource
getCodeSource()

Return the CodeSource for this policy entry

pack-priv List<PolicyParser.PrincipalEntry>
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

codesourceback to summary
private final CodeSource codesource
permissionsback to summary
pack-priv final List<Permission> permissions
principalsback to summary
private final List<PolicyParser.PrincipalEntry> principals

Constructor Detail

PolicyEntryback to summary
pack-priv PolicyEntry(CodeSource cs, List<PolicyParser.PrincipalEntry> principals)

Given a Permission and a CodeSource, create a policy entry. XXX Decide if/how to add validity fields and "purpose" fields to XXX policy entries

Parameters
cs:CodeSource

the CodeSource, which encapsulates the URL and the public key attributes from the policy config file. Validity checks are performed on the public key before PolicyEntry is called.

PolicyEntryback to summary
pack-priv PolicyEntry(CodeSource cs)

Method Detail

addback to summary
pack-priv void add(Permission p)

add a Permission object to this entry. No need to sync add op because perms are added to entry only while entry is being initialized

getCodeSourceback to summary
pack-priv CodeSource getCodeSource()

Return the CodeSource for this policy entry

getPrincipalsback to summary
pack-priv List<PolicyParser.PrincipalEntry> getPrincipals()
toStringback 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

private Class PolicyFile.PolicyInfo

extends Object
Class Inheritance

holds policy information that we need to synch on

Field Summary

Modifier and TypeField and Description
pack-priv final Map<Object, Object>
private final JavaSecurityAccess.ProtectionDomainCache[]
pack-priv final List<PolicyFile.PolicyEntry>
private Random
private static final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
PolicyInfo(int numCaches)

Method Summary

Modifier and TypeMethod and Description
pack-priv JavaSecurityAccess.ProtectionDomainCache
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasMappingback to summary
pack-priv final Map<Object, Object> aliasMapping
pdMappingback to summary
private final JavaSecurityAccess.ProtectionDomainCache[] pdMapping
policyEntriesback to summary
pack-priv final List<PolicyFile.PolicyEntry> policyEntries
randomback to summary
private Random random
verboseback to summary
private static final boolean verbose

Constructor Detail

PolicyInfoback to summary
pack-priv PolicyInfo(int numCaches)

Method Detail

getPdMappingback to summary
pack-priv JavaSecurityAccess.ProtectionDomainCache getPdMapping()
sun.security.provider back to summary

private Class PolicyFile.SelfPermission

extends Permission
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String
actions

The actions of the permission.

private Certificate[]
certs

The certs of the permission.

private String
name

Hides java.security.Permission.name.

The permission name.
private static final long
private String
type

The class name of the Permission class that will be created when this self permission is expanded .

Constructor Summary

AccessConstructor and Description
public
SelfPermission(String
the class name of the Permission class that will be created when this permission is expanded and if necessary resolved.
type
,
String
the name of the permission.
name
,
String
the actions of the permission.
actions
,
Certificate[]
the certificates the permission's class was signed with. This is a list of certificate chains, where each chain is composed of a signer certificate and optionally its supporting certificate chain. Each chain is ordered bottom-to-top (i.e., with the signer certificate first and the (root) certificate authority last).
certs
)

Creates a new SelfPermission containing the permission information needed later to expand the self

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if obj is an SelfPermission, and has the same type (class) name, permission name, actions, and certificates as this object.
equals
(Object
the object we are testing for equality with this object.
obj
)

Implements abstract java.security.Permission.equals.

Checks two SelfPermission objects for equality.

public String

Returns:

the empty string "".
getActions
()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions for an SelfPermission.

public Certificate[]
public String
public String
public String
public int

Returns:

the hash code value for this object
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

public boolean

Returns:

false.
implies
(Permission
the permission to check against.
p
)

Implements abstract java.security.Permission.implies.

This method always returns false for SelfPermission permissions.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Restores the state of this object from the stream.

public String

Returns:

information about this SelfPermission.
toString
()

Overrides java.security.Permission.toString.

Returns a string describing this SelfPermission.

Inherited from java.security.Permission:
checkGuardgetNamenewPermissionCollection

Field Detail

actionsback to summary
private String actions

The actions of the permission.

certsback to summary
private Certificate[] certs

The certs of the permission.

nameback to summary
private String name

Hides java.security.Permission.name.

The permission name.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Annotations
@Serial
typeback to summary
private String type

The class name of the Permission class that will be created when this self permission is expanded .

Constructor Detail

SelfPermissionback to summary
public SelfPermission(String type, String name, String actions, Certificate[] certs)

Creates a new SelfPermission containing the permission information needed later to expand the self

Parameters
type:String

the class name of the Permission class that will be created when this permission is expanded and if necessary resolved.

name:String

the name of the permission.

actions:String

the actions of the permission.

certs:Certificate[]

the certificates the permission's class was signed with. This is a list of certificate chains, where each chain is composed of a signer certificate and optionally its supporting certificate chain. Each chain is ordered bottom-to-top (i.e., with the signer certificate first and the (root) certificate authority last).

Method Detail

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Checks two SelfPermission objects for equality. Checks that obj is an SelfPermission, and has the same type (class) name, permission name, actions, and certificates as this object.

Parameters
obj:Object

the object we are testing for equality with this object.

Returns:boolean

true if obj is an SelfPermission, and has the same type (class) name, permission name, actions, and certificates as this object.

Annotations
@Override
getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions for an SelfPermission. That is, the actions for the permission that will be created when this SelfPermission is resolved may be non-null, but an SelfPermission itself is never considered to have any actions.

Returns:String

the empty string "".

Annotations
@Override
getCertsback to summary
public Certificate[] getCerts()
getSelfActionsback to summary
public String getSelfActions()
getSelfNameback to summary
public String getSelfName()
getSelfTypeback to summary
public String getSelfType()
hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

Returns:int

the hash code value for this object

Annotations
@Override
impliesback to summary
public boolean implies(Permission p)

Implements abstract java.security.Permission.implies.

This method always returns false for SelfPermission permissions. That is, an SelfPermission never considered to imply another permission.

Parameters
p:Permission

the permission to check against.

Returns:boolean

false.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Restores the state of this object from the stream.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
toStringback to summary
public String toString()

Overrides java.security.Permission.toString.

Returns a string describing this SelfPermission. The convention is to specify the class name, the permission name, and the actions, in the following format: '(unresolved "ClassName" "name" "actions")'.

Returns:String

information about this SelfPermission.

Annotations
@Override