PolicyEntrypublic class PolicyEntry extends Object This class represents an elementary block of a security policy. It associates
a CodeSource of an executable code, Principals allowed to execute the code,
and a set of granted Permissions. |
Fields Summary |
---|
private final CodeSource | cs | private final Principal[] | principals | private final Collection | permissions |
Constructors Summary |
---|
public PolicyEntry(CodeSource cs, Collection prs, Collection permissions)Constructor with initialization parameters. Passed collections are not
referenced directly, but copied.
this.cs = cs;
this.principals = (prs == null || prs.isEmpty()) ? null
: (Principal[]) prs.toArray(new Principal[prs.size()]);
this.permissions = (permissions == null || permissions.isEmpty()) ? null
: Collections.unmodifiableCollection(permissions);
|
Methods Summary |
---|
public java.util.Collection | getPermissions()Returns unmodifiable collection of permissions defined by this
PolicyEntry, may be null .
return permissions;
| public boolean | impliesCodeSource(java.security.CodeSource codeSource)Checks if passed CodeSource matches this PolicyEntry. Null CodeSource of
PolicyEntry implies any CodeSource; non-null CodeSource forwards to its
imply() method.
return (cs == null) ? true : cs.implies(codeSource);
| public boolean | impliesPrincipals(java.security.Principal[] prs)Checks if specified Principals match this PolicyEntry. Null or empty set
of Principals of PolicyEntry implies any Principals; otherwise specified
array must contain all Principals of this PolicyEntry.
return PolicyUtils.matchSubset(principals, prs);
| public boolean | isVoid()Returns true if this PolicyEntry defines no Permissions, false otherwise.
return permissions == null || permissions.size() == 0;
|
|