PDP Mapping for New Endpoints (inline preferred)
Where mappings live
- Preferred: inline per-route
authz_mapinServiceConfigs/BFF/config/routes.yamlwithauthz: pdp. - Legacy: external
ServiceConfigs/BFF/config/pdp.yaml:endpoint_map(supported during migration).
Pattern (verified)
- Map
METHODper path toresource,action, optionalid_from, and optionalpropsthat can extract$.fieldfrom JSON body or{param}from the URL.
Example (inline on route)
- id: "users-read"
path: "/api/v1/users/{user_id}"
target_service: "membership"
upstream_path: "/v1/users/{user_id}"
methods: ["GET"]
auth: "session"
authz: "pdp"
authz_map:
GET:
resource: "user"
id_from: "{user_id}"
action: "read"
Legacy external mapping (for migration)
/api/v1/users/{user_id}:
GET:
resource: "user"
id_from: "{user_id}"
action: "read"
How it’s applied (code‑verified)
- The resolver first checks for inline
authz_mapon the matched route. If absent,PathMapperServicecompiles regex from templates inpdp.yaml, extracts URL params and body fields, and returns(resource_type, resource_id, action, props)used byrequire_permission.
Quick validation
- Hit your endpoint; on authorization errors, check BFF logs for mapping debug lines and ensure method/path match and
id_fromresolves.