
Add policy-based authorization to Gorilla Mux HTTP handlers and middleware using the Cerbos Go SDK. Enforce fine-grained access control at the router level without hard-coding permission logic in every handler.
Add Cerbos checks as Gorilla Mux middleware to enforce permissions before requests reach your handler functions
Pass user identity and resource attributes through Go's context.Context, giving Cerbos the information it needs for attribute-based decisions
Move authorization rules out of handler functions and into versioned YAML policies that can be updated without recompiling your Go application
Building authorization logic inside Gorilla 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 Gorilla application stays focused on business logic while authorization policies evolve independently, managed by product or security teams without touching code.
Use the Cerbos Go SDK to create a client and call the Cerbos PDP from your Gorilla Mux handlers or middleware. You can build a middleware function that extracts the authenticated user from the request context, calls Cerbos to check permissions, and either allows the request to proceed or returns a 403.
Yes. Create a middleware function that wraps your handlers, extracts the principal and resource information from the request, and calls the Cerbos PDP. Attach it to specific routes or subrouters using Gorilla's middleware chaining. The Cerbos PDP responds in sub-millisecond time.
The Cerbos Go SDK accepts a context.Context, so it integrates naturally with Go's request lifecycle. You can pass the request context from your Gorilla handler directly to the Cerbos client, ensuring cancellation and timeouts propagate correctly.


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.