Package ddf.security.permission.impl
Class KeyValuePermissionImpl
java.lang.Object
ddf.security.permission.impl.KeyValuePermissionImpl
- All Implemented Interfaces:
ddf.security.permission.KeyValuePermission,org.apache.shiro.authz.Permission
public class KeyValuePermissionImpl
extends Object
implements ddf.security.permission.KeyValuePermission
Permission class comprised of a key and a list of corresponding values. Contains the logic to
determine if this key/value permission can imply another key/value permission.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new KeyValuePermission with the specified key and an empty list of values.KeyValuePermissionImpl(String key, List<String> values) Deprecated.KeyValuePermissionImpl(String key, Set<String> values) Creates a new KeyValuePermission with the specified key and corresponding list of values. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an additional value to the existing values.getKey()booleanimplies(org.apache.shiro.authz.Permission p) Returnstrueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargurment,falseotherwise.toString()Creates a string representation of this key/value permission object.
-
Constructor Details
-
KeyValuePermissionImpl
Creates a new KeyValuePermission with the specified key and an empty list of values.- Parameters:
key- the key to be used for this permission
-
KeyValuePermissionImpl
Deprecated.Creates a new KeyValuePermission with the specified key and corresponding list of values.- Parameters:
key- the key to be used for this permissionvalues- the list of values to be used for this permission- Throws:
IllegalArgumentException- if the key is null - a valid key is required
-
KeyValuePermissionImpl
Creates a new KeyValuePermission with the specified key and corresponding list of values.- Parameters:
key- the key to be used for this permissionvalues- the list of values to be used for this permission- Throws:
IllegalArgumentException- if the key is null - a valid key is required
-
-
Method Details
-
getKey
- Specified by:
getKeyin interfaceddf.security.permission.KeyValuePermission
-
getValues
- Specified by:
getValuesin interfaceddf.security.permission.KeyValuePermission
-
addValue
Adds an additional value to the existing values.- Specified by:
addValuein interfaceddf.security.permission.KeyValuePermission- Parameters:
value- new value to be added to the existing values for this key/value pair
-
implies
public boolean implies(org.apache.shiro.authz.Permission p) Returnstrueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargurment,falseotherwise.That is, this current instance must be exactly equal to or a superset of the functionality and/or resource access described by the given
Permissionargument. Yet another way of saying this would be:If "permission1 implies permission2", i.e.
permission1.implies(permission2), then any Subject grantedpermission1would have ability greater than or equal to that defined bypermission2.For KeyValuePermission objects this is determined as follows:
If the keys of each permission are equal and if the values from this object implies the values from the passed in permission, then this permission will imply the passed in permission.
- Specified by:
impliesin interfaceorg.apache.shiro.authz.Permission- Parameters:
p- permission to checked to see if this permission implies p- Returns:
trueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargument,falseotherwise.
-
toString
Creates a string representation of this key/value permission object.
-