Add policy-based authorization to Django views and middleware using the Cerbos Python SDK. Enforce fine-grained access control without hard-coding permission logic in views or models.
Add Cerbos checks in Django views or middleware to enforce permissions before requests reach your application logic
Pass user identity, request data, and model attributes from Django to Cerbos for context-aware authorization decisions
Move authorization rules out of Django views and model permissions into versioned YAML policies that update without redeployment
Building authorization logic inside Django quickly becomes a maintenance burden. Hard-coded role checks scatter across controllers and middleware, and every permission change requires a code deploy.
Cerbos replaces scattered authorization logic with a single API call. You define fine-grained policies in YAML, and the Cerbos PDP evaluates them at request time using roles, attributes, and any context you provide.
With Cerbos your Django application stays focused on business logic while authorization policies evolve independently, managed by product or security teams without touching code.
Use the Cerbos Python SDK to create a client and call the Cerbos PDP from your Django views or middleware. Extract the authenticated user from the request, build a Cerbos check request with the resource and action, and gate access based on the PDP response.
Yes. Create a Django middleware class that intercepts requests, extracts the principal and resource information, and calls the Cerbos PDP before the view executes. The Cerbos PDP responds in sub-millisecond time, adding negligible latency to request processing.
Cerbos can replace or augment Django's built-in permission system. Instead of defining permissions in models and checking them with decorators, you define authorization policies in YAML and evaluate them at request time through the Cerbos PDP.



What is Cerbos?
Cerbos is an end-to-end enterprise authorization software for Zero Trust environments and AI-powered systems. It enforces fine-grained, contextual, and continuous authorization across apps, APIs, AI agents, MCP servers, services, and workloads.
Cerbos consists of an open-source Policy Decision Point, Enforcement Point integrations, and a centrally managed Policy Administration Plane (Cerbos Hub) that coordinates unified policy-based authorization across your architecture. Enforce least privilege & maintain full visibility into access decisions with Cerbos authorization.