postkit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- postkit/__init__.py +9 -0
- postkit/authn/__init__.py +13 -0
- postkit/authn/client.py +567 -0
- postkit/authz/__init__.py +17 -0
- postkit/authz/client.py +913 -0
- postkit-0.1.0.dist-info/METADATA +66 -0
- postkit-0.1.0.dist-info/RECORD +8 -0
- postkit-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: postkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PostgreSQL-native authentication and authorization SDK
|
|
5
|
+
Project-URL: Homepage, https://github.com/varunchopra/postkit
|
|
6
|
+
Project-URL: Repository, https://github.com/varunchopra/postkit
|
|
7
|
+
Author: Varun Chopra
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Keywords: authentication,authorization,postgresql,rebac,sdk
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Database
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: psycopg>=3.1.0
|
|
22
|
+
Provides-Extra: binary
|
|
23
|
+
Requires-Dist: psycopg[binary]>=3.1.0; extra == 'binary'
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: psycopg[binary]>=3.1.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# postkit
|
|
30
|
+
|
|
31
|
+
PostgreSQL-native authentication and authorization SDK.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install postkit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import psycopg
|
|
43
|
+
from postkit.authz import AuthzClient
|
|
44
|
+
from postkit.authn import AuthnClient
|
|
45
|
+
|
|
46
|
+
conn = psycopg.connect("postgresql://...")
|
|
47
|
+
cursor = conn.cursor()
|
|
48
|
+
|
|
49
|
+
# Authorization
|
|
50
|
+
authz = AuthzClient(cursor, namespace="my-app")
|
|
51
|
+
authz.grant("admin", resource=("repo", "api"), subject=("user", "alice"))
|
|
52
|
+
if authz.check("alice", "read", ("repo", "api")):
|
|
53
|
+
print("Access granted")
|
|
54
|
+
|
|
55
|
+
# Authentication
|
|
56
|
+
authn = AuthnClient(cursor, namespace="my-app")
|
|
57
|
+
user_id = authn.create_user("alice@example.com", password_hash="argon2...")
|
|
58
|
+
session_id = authn.create_session(user_id, token_hash="sha256...")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- PostgreSQL 14+
|
|
64
|
+
- The postkit SQL schema installed in your database
|
|
65
|
+
|
|
66
|
+
See the [main repository](https://github.com/varunchopra/postkit) for SQL installation instructions.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
postkit/__init__.py,sha256=QJyLEqHEU4L3NGAHI8rSLnvLMXyTo0JIHqYdTnrnBKY,189
|
|
2
|
+
postkit/authn/__init__.py,sha256=UOmUAwMQwIA6s9NRXAAuorQV9PPSX6rQgDlxqtuCI3E,249
|
|
3
|
+
postkit/authn/client.py,sha256=aOMojwFriL15nD8ANkrwIaustWXGZWh9AhNLyCyDuMs,18945
|
|
4
|
+
postkit/authz/__init__.py,sha256=IW0VO1uZSKHTZi96gpQj5sqPNpkuSb82zhlrDXPur7Y,319
|
|
5
|
+
postkit/authz/client.py,sha256=nccQUxWp9rAayoe5CFt0o4Re6yVQ7w2KvOMRNC0y-Es,30591
|
|
6
|
+
postkit-0.1.0.dist-info/METADATA,sha256=saP8wKqxQdHwiybyEFYDwbQ5eQQYbugBWuRcQU9sbq4,2022
|
|
7
|
+
postkit-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
8
|
+
postkit-0.1.0.dist-info/RECORD,,
|