public class CachePolicyDecisionRequestHandler extends Object implements RequestHandler, AutoCloseable
RequestHandler
that caches policies.Modifier and Type | Class and Description |
---|---|
static class |
CachePolicyDecisionRequestHandler.DisconnectionStrategy
The different behaviours that can be applied in case of notifications disconnections.
|
Constructor and Description |
---|
CachePolicyDecisionRequestHandler(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine,
Clock clock,
Duration defaultTimeout,
Duration maximumTimeout,
NotificationService notificationService,
CachePolicyDecisionRequestHandler.DisconnectionStrategy disconnectionStrategy,
RequestHandler requestHandler)
Builds a
CachePolicyDecisionFilter . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Promise<ActionResponse,ResourceException> |
handleAction(Context context,
ActionRequest actionRequest)
Handles performing an action on a resource, and optionally returns an
associated result.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handleCreate, handleDelete, handlePatch, handleQuery, handleRead, handleUpdate
public CachePolicyDecisionRequestHandler(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, Clock clock, Duration defaultTimeout, Duration maximumTimeout, NotificationService notificationService, CachePolicyDecisionRequestHandler.DisconnectionStrategy disconnectionStrategy, RequestHandler requestHandler)
CachePolicyDecisionFilter
.caffeine
- The caffeine cache to use. Not null
.clock
- A clock providing access to the current instant, date and time using a time-zone, not null
.defaultTimeout
- The default duration for which to cache AM policy decisions.
If an AM policy decision provides a valid ttl value to specify the time until which the policy decision
remains valid, IG uses that value or the maxTimeout.maximumTimeout
- The maximum duration for which to cache AM policy decisions. If the ttl value provided by the AM
policy decision is after the current time plus the maxTimeout, IG uses the maxTimeout.
Can be null
.notificationService
- The notification service used to connect on AM websocket notifications.disconnectionStrategy
- The strategy to apply in case of notifications' disconnection.requestHandler
- The RequestHandler
to use to fetch the policy decisions.NullPointerException
- If caffeine or clock are null
.public Promise<ActionResponse,ResourceException> handleAction(Context context, ActionRequest actionRequest)
RequestHandler
Actions are parametric; a set of named parameters is provided as input to the action. The action result is a JSON object structure composed of basic Java types; its overall structure is defined by a specific implementation.
On completion, the action result (or null) must be used to complete the
returned Promise
. On failure, the returned Promise
must
be completed with the exception.
Action expects failure exceptions as follows: ForbiddenException
if access to the resource is forbidden. NotSupportedException
if
the requested functionality is not implemented/supported
BadRequestException
if the passed identifier, parameters or
filter is invalid NotFoundException
if the specified resource
could not be found.
handleAction
in interface RequestHandler
context
- The request server context, such as associated principal.actionRequest
- The action request.Promise
containing the result of the operation.public void close()
close
in interface AutoCloseable
Copyright 2011-2017 ForgeRock AS.