Class JndiPermission
- java.lang.Object
-
- java.security.Permission
-
- org.wildfly.naming.java.permission.JndiPermission
-
- All Implemented Interfaces:
Serializable,Guard
public final class JndiPermission extends Permission
Permission to access an object within the "java:" JNDI namespace.This permission does not span into bound nested contexts; such contexts may be governed by their own permission scheme.
The
namesegment of the permission is a JNDI path whose segments are separated by/characters. The name may be preceded with the stringjava:for compatibility with previous schemes. A name of<<ALL BINDINGS>>is translated to-for compatibility reasons.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intACTION_ADD_NAMING_LISTENERThe bitwise encoding of theaddNamingListeneraction.static intACTION_ALLThe bitwise encoding of the*action.static intACTION_BINDThe bitwise encoding of thebindaction.static intACTION_CREATE_SUBCONTEXTThe bitwise encoding of thecreateSubcontextaction.static intACTION_DESTROY_SUBCONTEXTThe bitwise encoding of thedestroySubcontextaction.static intACTION_LISTThe bitwise encoding of thelistaction.static intACTION_LIST_BINDINGSThe bitwise encoding of thelistBindingsaction.static intACTION_LOOKUPThe bitwise encoding of thelookupaction.static intACTION_REBINDThe bitwise encoding of therebindaction.static intACTION_UNBINDThe bitwise encoding of theunbindaction.
-
Constructor Summary
Constructors Constructor Description JndiPermission(String name, int actionBits)Construct a new instance using an action bitmask.JndiPermission(String name, String actions)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)Determine whether this object is equal to another.booleanequals(JndiPermission other)Determine whether this object is equal to another.intgetActionBits()Get the action bits.StringgetActions()Get the actions string.inthashCode()Get the hash code of this permission.booleanimplies(String name, int actionBits)Determine if this permission implies the givenactionsBitson the givenname.booleanimplies(String name, String actions)Determine if this permission implies the givenactionson the givenname.booleanimplies(Permission permission)Determine if this permission implies the other permission.booleanimplies(JndiPermission permission)Determine if this permission implies the other permission.PermissionCollectionnewPermissionCollection()Construct a new type-specific permission collection.JndiPermissionwithActions(int actionBits)Return a permission which is equal to this one except with additional action bits.JndiPermissionwithActions(String actions)Return a permission which is equal to this one except with additional actions.JndiPermissionwithNewActions(int actionBits)Return a permission which is equal to this one except with its actions reset toactionBits.JndiPermissionwithNewActions(String actions)Return a permission which is equal to this one except with its actions reset toactions.JndiPermissionwithoutActions(int actionBits)Return a permission which is equal to this one except without some action bits.JndiPermissionwithoutActions(String actions)Return a permission which is equal to this one except without some actions.-
Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
-
-
-
Field Detail
-
ACTION_BIND
public static final int ACTION_BIND
The bitwise encoding of thebindaction.- See Also:
- Constant Field Values
-
ACTION_REBIND
public static final int ACTION_REBIND
The bitwise encoding of therebindaction.- See Also:
- Constant Field Values
-
ACTION_UNBIND
public static final int ACTION_UNBIND
The bitwise encoding of theunbindaction.- See Also:
- Constant Field Values
-
ACTION_LOOKUP
public static final int ACTION_LOOKUP
The bitwise encoding of thelookupaction.- See Also:
- Constant Field Values
-
ACTION_LIST
public static final int ACTION_LIST
The bitwise encoding of thelistaction.- See Also:
- Constant Field Values
-
ACTION_LIST_BINDINGS
public static final int ACTION_LIST_BINDINGS
The bitwise encoding of thelistBindingsaction.- See Also:
- Constant Field Values
-
ACTION_CREATE_SUBCONTEXT
public static final int ACTION_CREATE_SUBCONTEXT
The bitwise encoding of thecreateSubcontextaction.- See Also:
- Constant Field Values
-
ACTION_DESTROY_SUBCONTEXT
public static final int ACTION_DESTROY_SUBCONTEXT
The bitwise encoding of thedestroySubcontextaction.- See Also:
- Constant Field Values
-
ACTION_ADD_NAMING_LISTENER
public static final int ACTION_ADD_NAMING_LISTENER
The bitwise encoding of theaddNamingListeneraction.- See Also:
- Constant Field Values
-
ACTION_ALL
public static final int ACTION_ALL
The bitwise encoding of the*action. This value is the bitwise-OR of all of the other action bits.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JndiPermission
public JndiPermission(String name, String actions)
Construct a new instance.- Parameters:
name- the path name (must not benull)actions- the actions (must not benull)
-
JndiPermission
public JndiPermission(String name, int actionBits)
Construct a new instance using an action bitmask. If a bit in the mask falls outside ofACTION_ALL, it is stripped.- Parameters:
name- the path name (must not benull)actionBits- the action bits
-
-
Method Detail
-
implies
public boolean implies(Permission permission)
Determine if this permission implies the other permission.- Specified by:
impliesin classPermission- Parameters:
permission- the other permission- Returns:
trueif this permission implies the other,falseif it does not orpermissionisnull
-
implies
public boolean implies(JndiPermission permission)
Determine if this permission implies the other permission.- Parameters:
permission- the other permission- Returns:
trueif this permission implies the other,falseif it does not orpermissionisnull
-
implies
public boolean implies(String name, String actions)
Determine if this permission implies the givenactionson the givenname.- Parameters:
name- the name (must not benull)actions- the actions (must not benull)- Returns:
trueif this permission implies theactionson thename,falseotherwise
-
implies
public boolean implies(String name, int actionBits)
Determine if this permission implies the givenactionsBitson the givenname.- Parameters:
name- the name (must not benull)actionBits- the action bits- Returns:
trueif this permission implies theactionBitson thename,falseotherwise
-
equals
public boolean equals(Object other)
Determine whether this object is equal to another.- Specified by:
equalsin classPermission- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
equals
public boolean equals(JndiPermission other)
Determine whether this object is equal to another.- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
hashCode
public int hashCode()
Get the hash code of this permission.- Specified by:
hashCodein classPermission- Returns:
- the hash code of this permission
-
getActions
public String getActions()
Get the actions string. The actions string will be a canonical version of the one passed in at construction.- Specified by:
getActionsin classPermission- Returns:
- the actions string (not
null)
-
getActionBits
public int getActionBits()
Get the action bits.- Returns:
- the action bits
-
withNewActions
public JndiPermission withNewActions(int actionBits)
Return a permission which is equal to this one except with its actions reset toactionBits. If the givenactionBitsequals the current bits of this permission, then this permission instance is returned; otherwise a new permission is constructed. Any action bits which fall outside ofACTION_ALLare silently ignored.- Parameters:
actionBits- the action bits to use- Returns:
- a permission with only the given action bits (not
null)
-
withNewActions
public JndiPermission withNewActions(String actions)
Return a permission which is equal to this one except with its actions reset toactions. If the givenactionsequals the current actions of this permission, then this permission instance is returned; otherwise a new permission is constructed.- Parameters:
actions- the actions to use (must not benull)- Returns:
- a permission with only the given action bits (not
null)
-
withActions
public JndiPermission withActions(int actionBits)
Return a permission which is equal to this one except with additional action bits. If the givenactionBitsdo not add any new actions, then this permission instance is returned; otherwise a new permission is constructed. Any action bits which fall outside ofACTION_ALLare silently ignored.- Parameters:
actionBits- the action bits to add- Returns:
- a permission with the union of permissions from this instance and the given bits (not
null)
-
withActions
public JndiPermission withActions(String actions)
Return a permission which is equal to this one except with additional actions. If the givenactionBitsdo not add any new actions, then this permission instance is returned; otherwise a new permission is constructed.- Parameters:
actions- the actions to add (must not benull)- Returns:
- a permission with the union of permissions from this instance and the given bits (not
null)
-
withoutActions
public JndiPermission withoutActions(int actionBits)
Return a permission which is equal to this one except without some action bits. If the givenactionBitsdo not remove any actions, then this permission instance is returned; otherwise a new permission is constructed. Any action bits which fall outside ofACTION_ALLare silently ignored.- Parameters:
actionBits- the action bits to remove- Returns:
- a permission with the given bits subtracted from this instance (not
null)
-
withoutActions
public JndiPermission withoutActions(String actions)
Return a permission which is equal to this one except without some actions. If the givenactionsdo not remove any actions, then this permission instance is returned; otherwise a new permission is constructed.- Parameters:
actions- the actions to remove (must not benull)- Returns:
- a permission with the given bits subtracted from this instance (not
null)
-
newPermissionCollection
public PermissionCollection newPermissionCollection()
Construct a new type-specific permission collection.- Overrides:
newPermissionCollectionin classPermission- Returns:
- the new permission collection instance (not
null)
-
-