public final class JndiPermission extends Permission implements Serializable
Pathname is the pathname of the file or directory granted the specified actions. A pathname that ends in "/*" indicates all the files and directories contained in that directory. A pathname that ends with "/-" indicates (recursively) all files and subdirectories contained in that directory. A pathname consisting of the special token "<<ALL BINDINGS>>" matches any file.
The actions to be granted are passed to the constructor in a string containing a list of one or more comma-separated keywords. The possible keywords are "bind", "rebind", "unbind", "lookup", "list", "listBindings", and "createSubcontext". Their meaning is defined as follows:
The actions string is converted to lowercase before processing.
Be careful when granting JndiPermissions. Think about the implications of granting read and especially write access to various files and directories. The "<<ALL BINDINGS>>" permission with write action is especially dangerous. This grants permission to write to the entire file system. One thing this effectively allows is replacement of the system binary, including the JVM runtime environment.
Please note: Code can always read a file from the same directory it's in (or a subdirectory of that directory); it does not need explicit permission to do so.
Permission
,
Permissions
,
PermissionCollection
Modifier and Type | Field and Description |
---|---|
static int |
ALL
All actions (bind, rebind, unbind, lookup, list, listBindings, createSubcontext)
|
static String |
ALL_ACTION |
static int |
BIND
bind action.
|
static String |
BIND_ACTION |
static int |
CREATE_SUBCONTEXT |
static String |
CREATE_SUBCONTEXT_ACTION |
static int |
LIST
list action.
|
static String |
LIST_ACTION |
static int |
LIST_BINDINGS |
static String |
LIST_BINDINGS_ACTION |
static int |
LOOKUP
lookup action.
|
static String |
LOOKUP_ACTION |
static int |
NONE
No actions.
|
static int |
REBIND
rebind action.
|
static String |
REBIND_ACTION |
static int |
UNBIND
unbind action.
|
static String |
UNBIND_ACTION |
Constructor and Description |
---|
JndiPermission(Name path,
int mask) |
JndiPermission(Name path,
String actions) |
JndiPermission(String path,
String actions)
Creates a new JndiPermission object with the specified actions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks two JndiPermission objects for equality.
|
String |
getActions()
Returns the "canonical string representation" of the actions.
|
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(Permission p)
Checks if this JndiPermission object "implies" the specified permission.
|
PermissionCollection |
newPermissionCollection()
Returns a new PermissionCollection object for storing JndiPermission
objects.
|
checkGuard, getName, toString
public static final int BIND
public static final int REBIND
public static final int UNBIND
public static final int LOOKUP
public static final int LIST
public static final int LIST_BINDINGS
public static final int CREATE_SUBCONTEXT
public static final int ALL
public static final int NONE
public static final String BIND_ACTION
public static final String REBIND_ACTION
public static final String UNBIND_ACTION
public static final String LOOKUP_ACTION
public static final String LIST_ACTION
public static final String LIST_BINDINGS_ACTION
public static final String ALL_ACTION
public static final String CREATE_SUBCONTEXT_ACTION
public JndiPermission(String path, String actions)
A pathname that ends in "/*" (where "/" is the file separator character,
'/'
) indicates all the files and directories contained in
that directory. A pathname that ends with "/-" indicates (recursively) all
files and subdirectories contained in that directory. The special pathname
"<<ALL BINDINGS>>" matches any file.
A pathname consisting of a single "*" indicates all the files in the current directory, while a pathname consisting of a single "-" indicates all the files in the current directory and (recursively) all files and subdirectories contained in the current directory.
A pathname containing an empty string represents an empty path.
path
- the pathname of the file/directory.actions
- the action string.IllegalArgumentException
- If actions is null
, empty or contains an action
other than the specified possible actions.public JndiPermission(Name path, int mask)
public boolean implies(Permission p)
More specifically, this method returns true if:
implies
in class Permission
p
- the permission to check against.true
if the specified permission is not
null
and is implied by this object,
false
otherwise.public boolean equals(Object obj)
equals
in class Permission
obj
- the object we are testing for equality with this object.true
if obj is a JndiPermission, and has the same
pathname and actions as this JndiPermission object,
false
otherwise.public int hashCode()
hashCode
in class Permission
public String getActions()
getActions
will
return the string "bind,unbind".getActions
in class Permission
public PermissionCollection newPermissionCollection()
JndiPermission objects must be stored in a manner that allows them to be
inserted into the collection in any order, but that also enables the
PermissionCollection implies
method to be implemented in an
efficient (and consistent) manner.
For example, if you have two JndiPermissions:
"/tmp/-", "bind"
"/tmp/scratch/foo", "unbind"
and you are calling the implies
method with the
JndiPermission:
"/tmp/scratch/foo", "bind,unbind",then the
implies
function must take into account both the
"/tmp/-" and "/tmp/scratch/foo" permissions, so the effective permission
is "bind,unbind", and implies
returns true. The "implies"
semantics for JndiPermissions are handled properly by the
PermissionCollection object returned by this
newPermissionCollection
method.newPermissionCollection
in class Permission
Copyright © 2017 JBoss by Red Hat. All rights reserved.