org.entityfs.util.security
Class XorAccessGranter
java.lang.Object
org.entityfs.util.security.XorAccessGranter
- All Implemented Interfaces:
- AccessGranter
public class XorAccessGranter
- extends Object
- implements AccessGranter
This is an AccessGranter
that combines the decisions from two other
access granters using the logical operation XOR
.
Instances of this class are immutable (but their wrapped access granters
might no be).
- Since:
- 1.0
- Author:
- Karl Gustafsson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XorAccessGranter
public XorAccessGranter(AccessGranter granter1,
AccessGranter granter2)
- Create a
XOR
access granter using the two provided access
granters.
- Parameters:
granter1
- The first access granter. If this is null, it is
considered to always return true
(in effect reversing the
decisions from the second access granter).granter2
- The second access granter. If this is null, it is
considered to always return true
(in effect reversing the
decisions from the first access granter).
hasAccess
public boolean hasAccess(Subject s,
Permission p)
- Description copied from interface:
AccessGranter
- Is the subject authorized for the permission?
- Specified by:
hasAccess
in interface AccessGranter
- Parameters:
s
- The subject. Might be null
.p
- The permission.
- Returns:
true
if the subject is authorized for the permission,
false
if not.