Class AuthorizationResult
- java.lang.Object
- 
- com.tibco.tibems.tibemsd.security.AuthorizationResult
 
- 
 public class AuthorizationResult extends java.lang.ObjectThis class represents the answer to an authorization request. The server will cache AuthorizationResults as they are returned by the isAllowed() method of an Authorizer. The exact caching behavior depends on the attributes of the AuthorizationResult.A timeout of zero means that the answer will not be cached at all. The authorization decision will only be returned to the server for immediate use. The values of this AuthorizationResult's destination and types will be ignored, and the result will only apply to the particular destination and Action.Type that were passed to isAllowed(). Any other timeout value will cause the server to cache this result. The server will not ask the Authorizer again about the given destination any earlier than the given timeout. The server will attempt to remove the result from the cache promptly after the timeout, causing the next matching query to be passed on to the Authorizer. Any timeout greater than the server's maximum timeout will be silently set to that maximum. The current maximum timeout value is returned by getMaxTimeout(). An AuthorizationResult need not have a destination set. In this case, the server will cache the result under the exact destination that was passed to the Authorizer's isAllowed() method. However, when an authorizer is asked about a specific destination, it may be useful to return information about a class of destinations, to make the cache more efficient. For instance, if the server asks about "foo.bar.baz", the Authorizer could return a result that allows access to "foo.>". If the AuthorizationResult has a non-null destination set, and it is a wildcard that contains the destination passed to Authorizer.isAllowed(), then the server will cache the result under that wildcard. The exact definition of "contains" is given by Util.isDestinationContainedBy(). Similarly, an AuthorizationResult can specify a set of Action.Types to which it applies. 
- 
- 
Constructor SummaryConstructors Constructor Description AuthorizationResult(boolean allowed)Creates a new AuthorizationResult with timeout 0, and destination null.AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit)Creates a new authorization result, with destination null.AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination)Creates a new authorization result.AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination, Action.Type... types)Creates a new authorization result.AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination, java.util.Set<Action.Type> types)Creates a new authorization result.AuthorizationResult(boolean allowed, java.lang.String destination)Creates a new AuthorizationResult with timeout 0.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappliesTo(java.lang.String candidate)static AuthorizationResultdenyMax(java.lang.String destination)static AuthorizationResultdenyNow()java.lang.StringgetDestination()static longgetMaxTimeout(java.util.concurrent.TimeUnit unit)Returns the maximum time to live for an AuthorizationResult.longgetTimeout(java.util.concurrent.TimeUnit unit)Action.Type[]getTypes()static AuthorizationResultgrantMax(java.lang.String destination)static AuthorizationResultgrantNow()booleanisAllowed()
 
- 
- 
- 
Constructor Detail- 
AuthorizationResultpublic AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination, Action.Type... types)Creates a new authorization result.- Parameters:
- allowed- true if the operation should be allowed. false otherwise.
- timeout- minimum time for this result to be cached
- unit- time unit for timeout parameter
- destination- destination for which this result should be cached
- types- an array of Action.Type for which this result should be cached
 
 - 
AuthorizationResultpublic AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination, java.util.Set<Action.Type> types)Creates a new authorization result.- Parameters:
- allowed- true if the operation should be allowed. false otherwise.
- timeout- minimum time for this result to be cached
- unit- time unit for timeout parameter
- destination- destination for which this result should be cached
- types- a set of Action.Type for which this result should be cached
 
 - 
AuthorizationResultpublic AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String destination)Creates a new authorization result.- Parameters:
- allowed- true if the operation should be allowed. false otherwise.
- timeout- minimum time for this result to be cached
- unit- time unit for timeout parameter
- destination- destination for which this result should be cached
 
 - 
AuthorizationResultpublic AuthorizationResult(boolean allowed, long timeout, java.util.concurrent.TimeUnit unit)Creates a new authorization result, with destination null.
 - 
AuthorizationResultpublic AuthorizationResult(boolean allowed) Creates a new AuthorizationResult with timeout 0, and destination null.
 - 
AuthorizationResultpublic AuthorizationResult(boolean allowed, java.lang.String destination)Creates a new AuthorizationResult with timeout 0.
 
- 
 - 
Method Detail- 
denyNowpublic static AuthorizationResult denyNow() - Returns:
- a negative AuthorizationResult that will not be cached.
 
 - 
getMaxTimeoutpublic static long getMaxTimeout(java.util.concurrent.TimeUnit unit) Returns the maximum time to live for an AuthorizationResult. Any AuthorizationResult created with a timeout greater than this will silently be reset to this timeout.- Parameters:
- unit- The time unit in which to express the return value
- Returns:
- The maximum time to live for AutorizationResults
 
 - 
denyMaxpublic static AuthorizationResult denyMax(java.lang.String destination) - Parameters:
- destination-
- Returns:
- a negative AuthorizationResult with the given destination, that will be cached for the maximum time allowed.
 
 - 
grantNowpublic static AuthorizationResult grantNow() - Returns:
- a positive AuthorizationResult that will not be cached.
 
 - 
grantMaxpublic static AuthorizationResult grantMax(java.lang.String destination) - Parameters:
- destination-
- Returns:
- a positive AuthorizationResult with the given destination, that will be cached for the maximum time allowed.
 
 - 
isAllowedpublic boolean isAllowed() 
 - 
getTimeoutpublic long getTimeout(java.util.concurrent.TimeUnit unit) 
 - 
getDestinationpublic java.lang.String getDestination() 
 - 
appliesTopublic boolean appliesTo(java.lang.String candidate) - Parameters:
- candidate- a destination to test.
- Returns:
- true if this AuthorizationResult specifies a wildcard destination that contains the candidate destination.
 
 - 
getTypespublic Action.Type[] getTypes() - Returns:
- the types
 
 
- 
 
-