Package org.osgi.service.dmt.security
Class DmtPrincipalPermission
java.lang.Object
java.security.Permission
org.osgi.service.dmt.security.DmtPrincipalPermission
- All Implemented Interfaces:
Serializable,Guard
Indicates the callers authority to create DMT sessions on behalf of a remote
management server. Only protocol adapters communicating with management
servers should be granted this permission.
DmtPrincipalPermission has a target string which controls the name of
the principal on whose behalf the protocol adapter can act. A wildcard is
allowed at the end of the target string, to allow using any principal name
with the given prefix. The "*" target means the adapter can create
a session in the name of any principal.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDmtPrincipalPermission(String target) Creates a newDmtPrincipalPermissionobject with its name set to the target string.DmtPrincipalPermission(String target, String actions) Creates a newDmtPrincipalPermissionobject using the 'canonical' two argument constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the given object is equal to this DmtPrincipalPermission instance.Returns the action list (always*in the current version).inthashCode()Returns the hash code for this permission object.booleanChecks if this DmtPrincipalPermission object implies the specified permission.Returns a new PermissionCollection object for storing DmtPrincipalPermission objects.Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
Constructor Details
-
DmtPrincipalPermission
Creates a newDmtPrincipalPermissionobject with its name set to the target string. Name must be non-null and non-empty.- Parameters:
target- the name of the principal, can end with*to match any principal with the given prefix- Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnameis empty
-
DmtPrincipalPermission
Creates a newDmtPrincipalPermissionobject using the 'canonical' two argument constructor. In this version this class does not define any actions, the second argument of this constructor must be "*" so that this class can later be extended in a backward compatible way.- Parameters:
target- the name of the principal, can end with*to match any principal with the given prefixactions- no actions defined, must be "*" for forward compatibility- Throws:
NullPointerException- ifnameoractionsisnullIllegalArgumentException- ifnameis empty oractionsis not "*"
-
-
Method Details
-
equals
Checks whether the given object is equal to this DmtPrincipalPermission instance. Two DmtPrincipalPermission instances are equal if they have the same target string.- Specified by:
equalsin classPermission- Parameters:
obj- the object to compare to this DmtPrincipalPermission instance- Returns:
trueif the parameter represents the same permissions as this instance
-
getActions
Returns the action list (always*in the current version).- Specified by:
getActionsin classPermission- Returns:
- the action string "*"
-
hashCode
public int hashCode()Returns the hash code for this permission object. If two DmtPrincipalPermission objects are equal according to theequals(Object)method, then calling this method on each of the two DmtPrincipalPermission objects must produce the same integer result.- Specified by:
hashCodein classPermission- Returns:
- hash code for this permission object
-
implies
Checks if this DmtPrincipalPermission object implies the specified permission. Another DmtPrincipalPermission instance is implied by this permission either if the target strings are identical, or if this target can be made identical to the other target by replacing a trailing "*" with any string.- Specified by:
impliesin classPermission- Parameters:
p- the permission to check for implication- Returns:
- true if this DmtPrincipalPermission instance implies the specified permission
-
newPermissionCollection
Returns a new PermissionCollection object for storing DmtPrincipalPermission objects.- Overrides:
newPermissionCollectionin classPermission- Returns:
- the new PermissionCollection
-