Search in sources :

Example 1 with ContainsKeyOperationContext

use of org.apache.geode.internal.cache.operations.ContainsKeyOperationContext in project geode by apache.

the class AuthorizeRequest method containsKeyAuthorize.

public void containsKeyAuthorize(String regionName, Object key) throws NotAuthorizedException {
    ContainsKeyOperationContext containsKeyContext = new ContainsKeyOperationContext(key);
    if (!this.authzCallback.authorizeOperation(regionName, containsKeyContext)) {
        String errStr = LocalizedStrings.AuthorizeRequest_NOT_AUTHORIZED_TO_PERFORM_CONTAINS_KEY_OPERATION_ON_REGION_0.toLocalizedString(regionName);
        this.logger.warning(LocalizedStrings.TWO_ARG_COLON, new Object[] { this, errStr });
        if (this.isPrincipalSerializable) {
            throw new NotAuthorizedException(errStr, this.principal);
        } else {
            throw new NotAuthorizedException(errStr);
        }
    } else {
        if (this.logger.finestEnabled()) {
            this.logger.finest(toString() + ": Authorized to perform CONTAINS_KEY operation on region [" + regionName + ']');
        }
    }
}
Also used : NotAuthorizedException(org.apache.geode.security.NotAuthorizedException) ContainsKeyOperationContext(org.apache.geode.internal.cache.operations.ContainsKeyOperationContext)

Aggregations

ContainsKeyOperationContext (org.apache.geode.internal.cache.operations.ContainsKeyOperationContext)1 NotAuthorizedException (org.apache.geode.security.NotAuthorizedException)1