A library to make writing, enforcing and auditing your authorization policies a breeze
Project description
An authorization library for Python.
Aims to provide the tools to organize, enforce and audit your authorization layer as easily as possible, letting you focus on the essential part: the actual rules.
Documentation
For the full documentation, go here
A sneak peek...
from entitled import Policy, Client
# Some actors and resources of your application...
class User:
def __init__(self, id: int, role: str):
self.id: str = id
self.role: str = role
class Resource:
def __init__(self, id: int, user: User):
self.id: str = id
self.owner: User = user
my_policy = Policy[Resource]("resource") # Defining a policy for your resource
@my_policy.rule("edit")# Declaring a rule on the resource
def can_edit(
actor: User, resource: Resource, context = None
) -> bool:
return actor == resource.owner or actor.role == "admin"
client = Client()
client.register(my_policy) # Registering a policy
user1 = User(1, "user")
resource1 = Resource(1, user1)
if client.allows("edit", user1, resource1): # Using the client to make auth decisions
...
Support us
Since 1997, XEFI is a leader in IT performance support for small and medium-sized businesses through its nearly 200 local agencies based in France, Belgium, Switzerland and Spain. A one-stop shop for IT, office automation, software, digitalization, print and cloud needs. Want to work with us ?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entitled-1.0.0.tar.gz.
File metadata
- Download URL: entitled-1.0.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0df541420a2137dc6e6f06ee7e912b2d3f1fa6e064b84a6bbb7e8cef5713299a
|
|
| MD5 |
849e2901cea8f64c7f349c547e566343
|
|
| BLAKE2b-256 |
a6424d2f058805dd3d1e11e98f2a42a755e7629870bddb8eaeeb84c39c6baaa3
|
Provenance
The following attestation bundles were made for entitled-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on xefi/python-entitled
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
entitled-1.0.0.tar.gz -
Subject digest:
0df541420a2137dc6e6f06ee7e912b2d3f1fa6e064b84a6bbb7e8cef5713299a - Sigstore transparency entry: 191474280
- Sigstore integration time:
-
Permalink:
xefi/python-entitled@2c734abfb0c1dfd21cff29db3249ee09a6f9ce8c -
Branch / Tag:
refs/tags/1.0 - Owner: https://github.com/xefi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@2c734abfb0c1dfd21cff29db3249ee09a6f9ce8c -
Trigger Event:
release
-
Statement type:
File details
Details for the file entitled-1.0.0-py3-none-any.whl.
File metadata
- Download URL: entitled-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e8ac52196a206d0384721716fa4edf2f910ecb1b4e354cd66e093b8650ca6be
|
|
| MD5 |
13a8ef1d723a8a873f7cff0501cd8389
|
|
| BLAKE2b-256 |
5574192880ddfbbc81dec8b7457c2084826c23c5a54f286d1ced229784767463
|
Provenance
The following attestation bundles were made for entitled-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on xefi/python-entitled
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
entitled-1.0.0-py3-none-any.whl -
Subject digest:
9e8ac52196a206d0384721716fa4edf2f910ecb1b4e354cd66e093b8650ca6be - Sigstore transparency entry: 191474281
- Sigstore integration time:
-
Permalink:
xefi/python-entitled@2c734abfb0c1dfd21cff29db3249ee09a6f9ce8c -
Branch / Tag:
refs/tags/1.0 - Owner: https://github.com/xefi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@2c734abfb0c1dfd21cff29db3249ee09a6f9ce8c -
Trigger Event:
release
-
Statement type: