Configure PDP (legacy pdp.yaml)
Status
- Preferred: define per-route inline
authz_mapinroutes.yamlwithauthz: pdp. - This page documents the legacy external
pdp.yamlused for endpoint mapping during migration.
What this file is
ServiceConfigs/BFF/config/pdp.yamlconfigures the BFF’s connection to the Policy Decision Point (PDP) and defines how API paths map to authorization resources/actions.- The BFF uses this file to ask the PDP “is user X allowed to perform action Y on resource Z?” for every protected request.
What is supported
- Connection and endpoints:
connection(base URL, client credentials),endpoints(evaluation,batch,search_actions). See canonical settings:../reference/settings-reference.md#pdp-integrationand anchors#env-PDP_BASE_URL,#env-PDP_TOKEN_URL,#env-PDP_CLIENT_ID,#env-PDP_CLIENT_SECRET. - Resilience:
retrywith max retries, backoff, and retryable status codes. - Performance:
cachewith separate TTLs for allow/deny, max size, and invalidation on policy change. See#env-PDP_CACHE_DECISIONS,#env-PDP_CACHE_TTLin settings reference. - Stability:
circuit_breakerwith thresholds and reset times. - Mapping:
endpoint_maptranslating path+method toresource,action, optionalid_from, andprops(simple JSONPath$.fieldextraction from request body). Prefer inlineauthz_mapon the correspondingroutes.yamlentries.
Example
connection:
base_url: http://pdp-service:8000
client_id: bff-service
client_secret: ${PDP_CLIENT_SECRET}
token_url: http://auth-server:8080/oauth/token
timeout: 5.0
verify_ssl: true
endpoints:
evaluation: v1/evaluation
batch: v1/evaluations
search_actions: access/v1/search/actions
cache:
enabled: true
ttl_allow: 300
ttl_deny: 60
endpoint_map:
/api/v1/membership/people/{person_id}:
GET:
resource: membership:people
id_from: "{person_id}"
action: read
How it’s enforced in the BFF
- Path mapping: when inline mapping exists, the resolver uses the route’s
authz_map. Otherwise,services/path_mapper.pyreadsendpoint_map, compiles rules, extracts URL params and body fields, and returns(resource, action, id, props). - Authorization:
core/permissions.pyassembles context (roles/permissions, headers, query/body subset, correlation ID) and callsservices/pdp_client.py. - Caching: allow/deny decisions are cached with separate TTLs from
pdp.yaml.
Flow
Tips
- Start small: add mappings for the endpoints you are enabling; expand iteratively.
- Use canonical prefixes (
/api/crud/**, preserved AuthZEN/access/v1/evaluation). - Set shorter TTL for deny to reduce false negatives after permissions change.
Migration helper
python -m ms_bff.src.tools.migrate_pdp_to_routes \
--routes ServiceConfigs/BFF/config/routes.yaml \
--pdp ServiceConfigs/BFF/config/pdp.yaml \
--out ServiceConfigs/BFF/config/routes.migrated.yaml
See also
- Reference → PDP integration settings:
../reference/settings-reference.md#pdp-integration - Reference → Routes reference:
../reference/routes-reference.md - How‑to → Validate endpoint_map entries (Quick Checklist)