惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
博客园_首页
博客园 - 聂微东
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
The Cloudflare Blog
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
D
Docker
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Jina AI
Jina AI
博客园 - Franky
D
DataBreaches.Net

Cerbos - All Posts

Authentik vs Keycloak: Self-hosted IdP comparison Mapping business requirements to authorization policy for automotive Fine-grained authorization for AI gateways EIC 2026: Stop counting agents, protect what they can touch Agent skill for writing authorization policies in Claude Desktop Identity security in 2026 EIC 2026 takeaways: the identity stack built for humans will not hold up for AI agents Already have authentication? Here's the authorization layer you still need. Tokens are authorization decisions: a guide to policy-driven token issuance What is a Runtime Authorization Platform It's a dimmer switch, not a kill switch. How CISOs are rethinking AI agent governance From maps to bitmaps (and from bitmaps to bitmaps) AuthZEN, Shared Signals, SCIM Events, IPSIE: Notes from the OpenID Enterprise Panel How do you update authorization policies without redeploying your application? IIW42 recap: Where agent authorization got real Cerbos PDP v0.52.0/v0.53.0: Engine performance, security hardening, and CEL path functions Authorization Management Platforms: what they do, how they work, and where they fit PocketOS AI coding agent deleted a production database in 9 seconds Non-Human Identity management still has a blind spot Supabase alternative in 2026: Best open source auth options Benefits of on-premise authorization: Why enterprises are moving toward self-hosted Authorization policies: How to write, test, and validate them (faster with AI) Agent skill for writing authorization policies How much does it cost to build authorization in-house? Why centralized authorization governance reduces incident response time OPA alternative Why AI agents make authorization a right now problem Modernizing legacy application authorization: why it’s your biggest security blind spot How to add authorization to legacy applications without code changes 5 authorization blind spots auditors find, and how to fix them
Revolutionizing authorization in Laravel applications
Aldin Kiselica · 2023-09-14 · via Cerbos - All Posts

We just released the Cerbos Laravel SDK – a seamless way to integrate Cerbos into your Laravel applications. With its objective to demystify the intricate world of roles and permissions, the SDK offers developers enhanced security paired with a polished user experience.

To show its potential, we also built a demo project. Picture a vibrant office where different employees, from varying departments and roles, engage in daily tasks. Within this ecosystem, managing expenses is paramount, and here’s where our cerbos/demo-laravel comes.

The Demo Storyline

We introduce two roles for the purpose of explaining this demo:

Sally: A sales associate operating within the EMEA region.

Derek: Part of the finance department, he holds both user and manager responsibilities.

These roles are pre-configured in the demo to illustrate potential Cerbos implementations for various user types. The demo story is as follows, Sally and Derek (and other pre-populated users of our expense management demo) are attempting various things in the system. In order to provide the needed level of security, Cerbos is used to allow or deny them certain actions, based on their roles in the company, the geography, and other relevant attributes.

Sally, as a sales associate is eligible to create and update her expense entries. Derek, on the other hand, is the finance manager in charge of taking care of expense entries, hence is (apart from viewing them) able to approve or reject them.

Now that we understand the possibilities of the demo, let's go into the setup process.

Deep Dive into Cerbos Policies

Before we jump to the SDK setup part of this walkthrough, let’s peek into the Cerbos configuration for the demo.

Cerbos-related configurations and file structure looks like this:

cerbos > policies >
|-- common_roles.yaml
|-- resource_expense.yaml
|-- resource_features.yaml
`-- config.yaml

The heart and soul of configuration in Cerbos, config.yaml contains the system setup, configurations, and more:

image

common_roles.yaml provides a guide into the dynamic roles, highlighting conditions that define roles like OWNER, FINANCE, etc:

image

The intricate mapping of roles to the expense resource is held in the resource_expense.yaml. It showcases permissions for actions based on various roles:

image

And lastly, we got resource_features.yaml, containing the features resource permissions, distinguishing roles like ADMIN, USER, and MANAGER:

image

All of the above defines how your application is going to treat various requests made by Sally, Derek and other employees curated for this demo. It gives you a glimpse into how your authorization may look if only you decoupled it from your codebase, and with such ease.

Getting Started with the Cerbos Laravel SDK

Ready to do it yourself? To get started with the Cerbos Laravel SDK, you should install the SDK. One way of doing it can be via Composer by running:

composer require cerbos/cerbos-sdk-laravel

Service providers are the central place of all Laravel application bootstrapping. As our composer.json defines it properly, the CerbosServiceProvider is auto-discovered and registered by default.

    "extra": {
        "laravel": {
            "providers": [
                "Cerbos\\Sdk\\Laravel\\Provider\\CerbosServiceProvider"
            ]
        }
    }

However, if needed, you can manually register the CerbosServiceProvider by adding it to your config/app.php:

'providers' => ServiceProvider::defaultProviders()->merge([
    // ...
    \Cerbos\Sdk\Laravel\Provider\CerbosServiceProvider::class,
])->toArray(),

Additionally, you can use the artisan vendor command which will create the config/cerbos.php for customizing the Cerbos configuration:

php artisan vendor:publish

Each configuration file, such as common_roles.yaml, resource_expense.yaml, and resource_features.yaml, helps in defining specific roles and permissions for different aspects of your application, ensuring that the right people have the right access.

To make the demo more relatable, it comes pre-filled with sample data for users and expenses. These can be found under the seeders:

User Seeds database/seeders/UserSeeder.phpExpense Seeds database/seeders/ExpenseSeeder.php

Running php artisan db:seed seeds the database with the following rows.

Define your own policies in Cerbos and watch as the SDK ensures that API calls adhere to these policies, granting or denying access as appropriate.

Explore & Test: With the sample data seeded, start making API requests. Try registering a new user or approving an expense. See how the SDK evaluates user roles, regions, and departments to make real-time authorization decisions.

In conclusion

The cerbos/demo-laravel project, in conjunction with the Cerbos Laravel SDK, exemplifies how effortless and efficient access control can be. Whether you're building enterprise-grade applications or simple projects, the SDK offers robust, fine-grained authorization checks tailored to your needs.

We invite developers to dive in, explore the demo, and experience first-hand the transformative impact of Cerbos Laravel SDK on their Laravel applications. Created anything fun or useful with it? Join our slack community and tell us all about it.