jCasbin enforces authorization in Java applications using configurable models such as ACL, RBAC, and ABAC without handling authentication itself.
Overview
jCasbin is the Java implementation of Apache Casbin, an access control library that evaluates whether a subject may perform an action on a resource. It supports many policy models, including role-based and attribute-based schemes, through CONF files built on the PERM metamodel.
The enforcer loads a model definition and policy rules from files or databases via adapters. At runtime it checks requests in classic subject-object-action form or custom shapes you define, including allow and deny effects with deny-override and priority ordering where configured.
The library stores policies and role mappings, exposes management APIs for permissions at runtime, and supplies built-in matcher helpers such as keyMatch and regexMatch. It does not verify passwords or maintain user accounts; applications own authentication and user lists.
Matcher expressions are evaluated with jCasbin’s own expression engine. Optional Spring Boot starter integration is mentioned for quicker assembly in Spring applications.
Key features
- ACL, RBAC, and ABAC models
- CONF-based PERM models
- File and database policy storage
- Runtime policy management APIs
- Role hierarchy management
- Built-in matcher functions
- Deny-override and priority rules
- Spring Boot starter available
Use cases
- API authorization in Java services
- Multi-tenant RBAC policies
- Fine-grained resource permissions
- Centralized policy enforcement