Skip to main content

2 posts tagged with "middleware"

middleware tag description

View All Tags

Authorization in the App Layer: Using Casbin Flask Middleware

· 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

If your deployment environment doesn't support a service mesh like Envoy or an external authorization server (common in simpler, monolithic, or traditional hosting setups), you can certainly move the Casbin authorization check into your Flask application using middleware or decorators.

This approach centralizes authorization logic within the Python code, relying on dedicated extensions like flask-authz or Flask-Casbin.

Implement Casbin sidecar pattern

· 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

1. The Casbin Sidecar Pattern​

A sidecar is a helper container that runs alongside your main application container (the Flask app) inside the same Kubernetes Pod [4]. The sidecar, in this case, is the Envoy Proxy, which intercepts all incoming and outgoing traffic for your Flask application.