The JSON Masking Authorizer enforces PlainID Policies on JSON payloads, typically API responses, before they reach the client. A service or API gateway sends the payload to the Authorizer together with the identity of the caller. The Authorizer asks the PlainID Policy Decision Point (PDP) what this identity may see, removes the objects the identity may not access, masks the properties it may only partially see, and returns the authorized JSON.
The Authorizer supports two enforcement modes. Each request selects its mode with parameters.calculationType, so one deployment serves both.
| Mode | calculationType |
How it works | Use it when |
|---|---|---|---|
| Resolution (default) | resolution or empty |
The Authorizer calls the PDP Policy Resolution endpoint and builds masking and filtering from the Asset Attributes and Actions in the response. | You already run the Authorizer and want it to keep working unchanged. |
| Data Instructions | dataInstructions |
The PDP Data Instructions endpoint returns ready-to-apply row rules and masking instructions for each data object, and the Authorizer applies them. | You build new Policies, want deny by default, or want masking values to come from your Policies instead of the Authorizer configuration. |
Note: Adding Data Instructions mode is fully backward compatible. Resolution remains the default, and existing deployments, configurations, and Policies keep working without changes.
A third calculation type, context, sends values from the payload to the PDP as Asset context. Use it when Policies need Asset Attributes that the JSON payload does not contain. For details, see Integration Patterns.
The following diagram shows where the Authorizer sits in a typical request flow.
.pptx%20(4)%201.png)
- A user logs in to an application and requests data.
- The application calls a microservice to request data from the data repository.
- The microservice receives the data and builds the JSON objects to return.
- The microservice or API gateway sends the JSON objects to the JSON Masking Authorizer.
- The Authorizer asks the PDP for the user's access, removes and masks objects and properties based on the answer, and returns the authorized objects.
- The microservice returns the objects to the application, and the user receives only authorized data.
Data Instructions Mode Benefits
- Explicit Actions. Every masking Action uses the format
OPERATION::value::priority, with three operations: REPLACE, FUNCTION, and VIEW. The masking value comes from the Action. - Row rules from Policies. Allow Policies and Deny (Restrict) Policies on the data object decide which objects stay in the payload.
- Conditional masking. The data object Ruleset of a masking Policy becomes the condition of its masking instructions, for example masking a card number only on US accounts.
- Deny by default. With
leastPrivileges: true, the Authorizer returns only the objects and properties that a Policy grants.
Getting Started with Data Instructions Mode
If you already run the Authorizer in Resolution mode, you can start using Data Instructions mode without changing your existing setup:
- Upgrade the Authorizer to a version that supports Data Instructions mode, and add the Data Instructions keys to its configuration. See Deployment Guide.
- Model the data object and masking catalog Asset Types, and create your row and masking Policies. See Policy Implementation.
- Send
calculationType: "dataInstructions"in the requests that should use the new mode. Requests without it keep using Resolution mode. See Integration Patterns.
Patterns and Implementation
Before you implement Policies on your JSON payloads, learn how to deploy the Authorizer, how your services call it, and how it enforces Policies at runtime.
Deployment and Integration Patterns
- Deployment Guide: Deploy the Authorizer with Helm, as part of the PAA, or as a standalone service, and configure both modes.
- Integration Patterns: Call the
enforceendpoint, and review the request parameters, responses, and errors.
Policy Implementation
- Policy Implementation: Model Asset Types and Policies, and review the Supported Actions, row rules, and deny by default.
- Data Instructions Guided Example: Build and test a complete Data Instructions setup end to end, with
leastPrivilegesset tofalseandtrue.
Related articles: Policy Authoring for Data · Data Access Authorization Pattern · SQL Database Authorizer