the37lab-authlib 0.1.1749279172__tar.gz → 0.1.1749553514__tar.gz
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.
Potentially problematic release.
This version of the37lab-authlib might be problematic. Click here for more details.
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/PKG-INFO +1 -1
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/README.md +97 -97
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/pyproject.toml +16 -16
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/__init__.py +4 -4
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/auth.py +512 -519
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/db.py +73 -73
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/decorators.py +30 -30
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/exceptions.py +10 -10
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/models.py +94 -94
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib.egg-info/PKG-INFO +1 -1
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/setup.cfg +0 -0
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib.egg-info/SOURCES.txt +0 -0
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib.egg-info/dependency_links.txt +0 -0
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib.egg-info/requires.txt +0 -0
- {the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib.egg-info/top_level.txt +0 -0
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
# AuthLib
|
|
2
|
-
|
|
3
|
-
A Python authentication library that provides JWT, OAuth2, and API token authentication with PostgreSQL backend.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
- [Installation](#installation)
|
|
7
|
-
- [Quick Start](#quick-start)
|
|
8
|
-
- [Configuration](#configuration)
|
|
9
|
-
- [API Endpoints](#api-endpoints)
|
|
10
|
-
- [Development](#development)
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
pip install -e .
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
```python
|
|
21
|
-
from flask import Flask
|
|
22
|
-
from authlib import AuthManager
|
|
23
|
-
|
|
24
|
-
app = Flask(__name__)
|
|
25
|
-
|
|
26
|
-
auth = AuthManager(
|
|
27
|
-
app=app,
|
|
28
|
-
db_dsn="postgresql://user:pass@localhost/dbname",
|
|
29
|
-
jwt_secret="your-secret-key",
|
|
30
|
-
oauth_config={
|
|
31
|
-
"google": {
|
|
32
|
-
"client_id": "your-client-id",
|
|
33
|
-
"client_secret": "your-client-secret"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
@app.route("/protected")
|
|
39
|
-
@auth.require_auth(roles=["admin"])
|
|
40
|
-
def protected_route():
|
|
41
|
-
return "Protected content"
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Configuration
|
|
45
|
-
|
|
46
|
-
### Required Parameters
|
|
47
|
-
- `app`: Flask application instance
|
|
48
|
-
- `db_dsn`: PostgreSQL connection string
|
|
49
|
-
- `jwt_secret`: Secret key for JWT signing
|
|
50
|
-
|
|
51
|
-
### Optional Parameters
|
|
52
|
-
- `oauth_config`: Dictionary of OAuth provider configurations
|
|
53
|
-
- `token_expiry`: JWT token expiry time in seconds (default: 3600)
|
|
54
|
-
- `refresh_token_expiry`: Refresh token expiry time in seconds (default: 2592000)
|
|
55
|
-
|
|
56
|
-
## API Endpoints
|
|
57
|
-
|
|
58
|
-
### Authentication
|
|
59
|
-
- `POST /v1/users/login` - Login with username/password
|
|
60
|
-
- `POST /v1/users/login/oauth` - Get OAuth redirect URL
|
|
61
|
-
- `GET /v1/users/login/oauth2callback` - OAuth callback
|
|
62
|
-
- `POST /v1/users/token-refresh` - Refresh JWT token
|
|
63
|
-
|
|
64
|
-
### User Management
|
|
65
|
-
- `POST /v1/users/register` - Register new user
|
|
66
|
-
- `GET /v1/users/login/profile` - Get user profile
|
|
67
|
-
- `GET /v1/users/roles` - Get available roles
|
|
68
|
-
|
|
69
|
-
### API Tokens
|
|
70
|
-
- `POST /v1/users/{user}/api-tokens` - Create API token
|
|
71
|
-
- `GET /v1/users/{user}/api-tokens` - List API tokens
|
|
72
|
-
- `DELETE /v1/users/{user}/api-tokens/{token_id}` - Delete API token
|
|
73
|
-
|
|
74
|
-
## Development
|
|
75
|
-
|
|
76
|
-
### Setup
|
|
77
|
-
1. Clone the repository
|
|
78
|
-
2. Create virtual environment:
|
|
79
|
-
```bash
|
|
80
|
-
python -m venv venv
|
|
81
|
-
venv\Scripts\activate
|
|
82
|
-
```
|
|
83
|
-
3. Install dependencies:
|
|
84
|
-
```bash
|
|
85
|
-
pip install -e ".[dev]"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Database Setup
|
|
89
|
-
```bash
|
|
90
|
-
createdb authlib
|
|
91
|
-
python -m authlib.cli db init
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Running Tests
|
|
95
|
-
```bash
|
|
96
|
-
pytest
|
|
97
|
-
```
|
|
1
|
+
# AuthLib
|
|
2
|
+
|
|
3
|
+
A Python authentication library that provides JWT, OAuth2, and API token authentication with PostgreSQL backend.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Configuration](#configuration)
|
|
9
|
+
- [API Endpoints](#api-endpoints)
|
|
10
|
+
- [Development](#development)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install -e .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from flask import Flask
|
|
22
|
+
from authlib import AuthManager
|
|
23
|
+
|
|
24
|
+
app = Flask(__name__)
|
|
25
|
+
|
|
26
|
+
auth = AuthManager(
|
|
27
|
+
app=app,
|
|
28
|
+
db_dsn="postgresql://user:pass@localhost/dbname",
|
|
29
|
+
jwt_secret="your-secret-key",
|
|
30
|
+
oauth_config={
|
|
31
|
+
"google": {
|
|
32
|
+
"client_id": "your-client-id",
|
|
33
|
+
"client_secret": "your-client-secret"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
@app.route("/protected")
|
|
39
|
+
@auth.require_auth(roles=["admin"])
|
|
40
|
+
def protected_route():
|
|
41
|
+
return "Protected content"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
### Required Parameters
|
|
47
|
+
- `app`: Flask application instance
|
|
48
|
+
- `db_dsn`: PostgreSQL connection string
|
|
49
|
+
- `jwt_secret`: Secret key for JWT signing
|
|
50
|
+
|
|
51
|
+
### Optional Parameters
|
|
52
|
+
- `oauth_config`: Dictionary of OAuth provider configurations
|
|
53
|
+
- `token_expiry`: JWT token expiry time in seconds (default: 3600)
|
|
54
|
+
- `refresh_token_expiry`: Refresh token expiry time in seconds (default: 2592000)
|
|
55
|
+
|
|
56
|
+
## API Endpoints
|
|
57
|
+
|
|
58
|
+
### Authentication
|
|
59
|
+
- `POST /v1/users/login` - Login with username/password
|
|
60
|
+
- `POST /v1/users/login/oauth` - Get OAuth redirect URL
|
|
61
|
+
- `GET /v1/users/login/oauth2callback` - OAuth callback
|
|
62
|
+
- `POST /v1/users/token-refresh` - Refresh JWT token
|
|
63
|
+
|
|
64
|
+
### User Management
|
|
65
|
+
- `POST /v1/users/register` - Register new user
|
|
66
|
+
- `GET /v1/users/login/profile` - Get user profile
|
|
67
|
+
- `GET /v1/users/roles` - Get available roles
|
|
68
|
+
|
|
69
|
+
### API Tokens
|
|
70
|
+
- `POST /v1/users/{user}/api-tokens` - Create API token
|
|
71
|
+
- `GET /v1/users/{user}/api-tokens` - List API tokens
|
|
72
|
+
- `DELETE /v1/users/{user}/api-tokens/{token_id}` - Delete API token
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
### Setup
|
|
77
|
+
1. Clone the repository
|
|
78
|
+
2. Create virtual environment:
|
|
79
|
+
```bash
|
|
80
|
+
python -m venv venv
|
|
81
|
+
venv\Scripts\activate
|
|
82
|
+
```
|
|
83
|
+
3. Install dependencies:
|
|
84
|
+
```bash
|
|
85
|
+
pip install -e ".[dev]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Database Setup
|
|
89
|
+
```bash
|
|
90
|
+
createdb authlib
|
|
91
|
+
python -m authlib.cli db init
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Running Tests
|
|
95
|
+
```bash
|
|
96
|
+
pytest
|
|
97
|
+
```
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools", "wheel"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "the37lab_authlib"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "Python SDK for the Authlib"
|
|
9
|
-
authors = [{name = "the37lab", email = "info@the37lab.com"}]
|
|
10
|
-
dependencies = ["flask", "psycopg2-binary", "pyjwt", "python-dotenv", "requests", "authlib", "bcrypt"]
|
|
11
|
-
requires-python = ">=3.9"
|
|
12
|
-
readme = "README.md"
|
|
13
|
-
classifiers = [
|
|
14
|
-
"Programming Language :: Python :: 3",
|
|
15
|
-
"License :: Other/Proprietary License",
|
|
16
|
-
"Operating System :: OS Independent",
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "the37lab_authlib"
|
|
7
|
+
version = "0.1.1749553514"
|
|
8
|
+
description = "Python SDK for the Authlib"
|
|
9
|
+
authors = [{name = "the37lab", email = "info@the37lab.com"}]
|
|
10
|
+
dependencies = ["flask", "psycopg2-binary", "pyjwt", "python-dotenv", "requests", "authlib", "bcrypt"]
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: Other/Proprietary License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
17
|
]
|
{the37lab_authlib-0.1.1749279172 → the37lab_authlib-0.1.1749553514}/src/the37lab_authlib/__init__.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from .auth import AuthManager
|
|
2
|
-
from .decorators import require_auth
|
|
3
|
-
|
|
4
|
-
__version__ = "0.1.0"
|
|
1
|
+
from .auth import AuthManager
|
|
2
|
+
from .decorators import require_auth
|
|
3
|
+
|
|
4
|
+
__version__ = "0.1.0"
|
|
5
5
|
__all__ = ["AuthManager", "require_auth"]
|