|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.freshcookies.security.policy.Canonicalizer
public class Canonicalizer
Utility class that canonicalizes Permissions and file paths. Canonicalizer will initialize a list of property substitutions that can be used when constructing file paths. This class can optionally dump a list of system properties (and their file path equivalents) to disk.
Field Summary | |
---|---|
static java.lang.String |
NO_CODESOURCE
Static String that means "no codesource." |
Constructor Summary | |
---|---|
Canonicalizer()
Constructs a new Canonicalizer instance. |
Method Summary | |
---|---|
java.security.CodeSource |
canonicalize(java.security.CodeSource codeSource,
java.util.Properties properties)
Canonicalizes a CodeSource. |
java.security.Permission |
canonicalize(java.security.Permission permission)
Normalizes permissions by changing permission targets to canonical forms. |
static java.lang.String |
format(java.security.CodeSource codeSource)
Formats a CodeSource for use with a policy file. |
static java.lang.String |
format(java.security.Permission permission)
Formats a CachedPermission for use in a policy file or log file. |
static java.lang.String |
format(java.security.Principal principal)
Formats a CachedPrincipal for use with a policy file. |
static java.lang.String |
format(java.security.Principal[] principals)
Formats an array of Principals; the array may be null . |
static java.lang.String |
format(java.security.Principal[] principals,
boolean forPolicy)
Formats an array of CachedPrincipals, optionally with line delimeters suitable for a policy file. |
static java.util.Properties |
getPathSubstitutions()
Returns a Map of key/value pairs that correspond the subset of System properties that correspond to valid file paths. |
java.security.CodeSource |
propertize(java.security.CodeSource codeSource,
java.util.Properties properties)
Formats a CodeSource, substituting properties into the CodeSource or path, as needed. |
java.security.Permission |
propertize(java.security.Permission perm,
java.util.Properties properties)
Substitutes properties into a given FilePermission 's URL
or path, as needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NO_CODESOURCE
Constructor Detail |
---|
public Canonicalizer()
Method Detail |
---|
public final java.security.CodeSource propertize(java.security.CodeSource codeSource, java.util.Properties properties)
codeSource
- the code sourceproperties
- a Properties map containing key-value pairs of property names
and associated file paths
public final java.security.Permission propertize(java.security.Permission perm, java.util.Properties properties)
FilePermission
's URL
or path, as needed.
perm
- the permissionproperties
- a Properties map containg key-value pairs of property names
and associated file paths
FilePermission
's URL or
file path, with system properties substitutions as neededpublic static final java.lang.String format(java.security.CodeSource codeSource)
${user.home}
) as
needed.
codeSource
- the code source
public static final java.lang.String format(java.security.Principal[] principals)
null
.
principals
- the array of Principals to formatted
public static final java.lang.String format(java.security.Principal[] principals, boolean forPolicy)
null
.
principals
- the array of CachedPrincipals to formattedforPolicy
- true
if the string should be formatted for a
policy file, with indents and a linebreak after each principal
public static final java.util.Properties getPathSubstitutions()
public static final java.lang.String format(java.security.Principal principal)
principal
- the Principal to format
public static final java.lang.String format(java.security.Permission permission)
permission
- the Permission to format
public final java.security.CodeSource canonicalize(java.security.CodeSource codeSource, java.util.Properties properties) throws java.io.IOException
${
and
ending in }
), the canonicalizer will attempt to
substitute in the correct path name by consulting the supplied properties
map.
codeSource
- the CodeSourceproperties
- the properties to use for expansion, where the the path names
are keys, and property names are values
java.io.IOException
public final java.security.Permission canonicalize(java.security.Permission permission)
Normalizes permissions by changing permission targets to canonical forms. For example:
FilePermission
paths are converted to canonical form
(symbolic links dereferenced), if possible. If the file path contains a
property substitution (prefixed by ${
and ending in
}
), the canonicalizer will not attempt to
substitute in the correct path nameSocketPermission
local host names 127.0.0.1 and ""
are converted to localhost
All other permission types are returned unchanged.
permission
- the permission to canonicalize
java.net.UnknownHostException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |