Package dev.cerbos.sdk
Class CerbosBlockingClient
- java.lang.Object
-
- dev.cerbos.sdk.CerbosBlockingClient
-
public class CerbosBlockingClient extends java.lang.ObjectCerbosBlockingClient provides a client implementation that blocks waiting for a response from the PDP.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CheckResourcesRequestBuilderbatch(Principal principal)Build a new batch request using the given principal.CheckResourcesRequestBuilderbatch(Principal principal, AuxData auxData)Build a new batch request using the given principal and auxData.CheckResultcheck(Principal principal, Resource resource, java.lang.String... actions)Check whether the principal is allowed to perform the actions on the given resource.PlanResourcesResultplan(Principal principal, Resource resource, java.lang.String action)Obtain a query plan for performing the given action on the given resource kind.CerbosBlockingClientwith(AuxData auxData)Automatically attach the provided auxiliary data to requests.
-
-
-
Method Detail
-
with
public CerbosBlockingClient with(AuxData auxData)
Automatically attach the provided auxiliary data to requests.- Parameters:
auxData-AuxDatainstance- Returns:
- new CerbosBlockingClient configured to attach the auxiliary data to requests.
-
check
public CheckResult check(Principal principal, Resource resource, java.lang.String... actions)
Check whether the principal is allowed to perform the actions on the given resource.- Parameters:
principal- Principal performing the actionresource- Resource being accessedactions- List of actions being performed on the resource- Returns:
- Map keyed by action and a corresponding boolean to indicate whether it is allowed or not.
- Throws:
CerbosException- if an RPC error occurs
-
batch
public CheckResourcesRequestBuilder batch(Principal principal)
Build a new batch request using the given principal.- Parameters:
principal- Principal performing the actions on resources.- Returns:
- Instance of
CheckResourcesRequestBuilder
-
batch
public CheckResourcesRequestBuilder batch(Principal principal, AuxData auxData)
Build a new batch request using the given principal and auxData.- Parameters:
principal- Principal performing the actions on resources.auxData-AuxDatainstance- Returns:
- Instance of
CheckResourcesRequestBuilder
-
plan
public PlanResourcesResult plan(Principal principal, Resource resource, java.lang.String action)
Obtain a query plan for performing the given action on the given resource kind.- Parameters:
principal- Principal performing the action on the resource kind.resource- Resource kind.action- Action to generate the plan for.- Returns:
- Instance of
PlanResourcesResult - Throws:
CerbosException- if the RPC fails.
-
-