devlab-auth 0.1.0__tar.gz → 0.3.0__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.
- devlab_auth-0.3.0/.env.example +2 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/.gitignore +6 -0
- devlab_auth-0.3.0/CHANGELOG.md +17 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/PKG-INFO +10 -1
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/README.md +9 -0
- devlab_auth-0.3.0/package.json +16 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/pyproject.toml +10 -1
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/__init__.py +3 -0
- devlab_auth-0.3.0/src/devlab_auth/constants.py +4 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/jwks.py +2 -1
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/uv.lock +1 -1
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/client.py +0 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/fastapi.py +0 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/m2m.py +0 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/middleware.py +0 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/models.py +0 -0
- {devlab_auth-0.1.0 → devlab_auth-0.3.0}/src/devlab_auth/py.typed +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @yuva-devlab/auth-py
|
|
2
|
+
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f5100bc: feat(packages): centralize jwks discovery path and fix cli iterator
|
|
8
|
+
|
|
9
|
+
- Define `DEFAULT_JWKS_PATH` and `DEFAULT_OPENID_CONFIG_PATH` across auth-server, auth-client, auth-py, and cli
|
|
10
|
+
- Replace ad-hoc string literals with canonical constants for ecosystem-wide route configuration
|
|
11
|
+
- Fix TS2802 iterator error in CLI token inspection command and configure es2022 compiler target
|
|
12
|
+
|
|
13
|
+
## 0.2.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 4896b97: Add universal Python authentication SDK (`devlab-auth`) with RS256 JWKS validation, M2M API key caching, and FastAPI route guards.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: devlab-auth
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Universal DevLab Authentication SDK for Python (RS256 JWKS & M2M API Keys with FastAPI guards)
|
|
5
5
|
Author-email: Yuvaraj Pattabi <yuva.devlab@gmail.com>
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -23,6 +23,7 @@ Description-Content-Type: text/markdown
|
|
|
23
23
|
Enterprise-grade authentication SDK and FastAPI security guards for the Yuva DevLab platform ecosystem.
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
|
+
|
|
26
27
|
- **Strict Typing:** 100% type-annotated with `py.typed` marker (PEP 561) and strict mypy compliance.
|
|
27
28
|
- **RS256 JWKS Verification:** Validates DevLab Portal SSO tokens without network overhead using local in-memory public key caching.
|
|
28
29
|
- **M2M API Key Validation:** Authenticates machine-to-machine callers (`dlk_...`) via DevLab Portal API with local TTL caching.
|
|
@@ -30,6 +31,7 @@ Enterprise-grade authentication SDK and FastAPI security guards for the Yuva Dev
|
|
|
30
31
|
- **ASGI Middleware:** Global route protection via `DevLabAuthMiddleware`.
|
|
31
32
|
|
|
32
33
|
## Installation
|
|
34
|
+
|
|
33
35
|
```bash
|
|
34
36
|
# Using uv
|
|
35
37
|
uv add devlab-auth
|
|
@@ -39,6 +41,7 @@ pip install devlab-auth
|
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
## Quickstart (FastAPI)
|
|
44
|
+
|
|
42
45
|
```python
|
|
43
46
|
from fastapi import FastAPI, Depends
|
|
44
47
|
from devlab_auth import AuthPrincipal, get_current_principal, require_role
|
|
@@ -61,6 +64,7 @@ async def admin_purge():
|
|
|
61
64
|
```
|
|
62
65
|
|
|
63
66
|
## Development & Verification
|
|
67
|
+
|
|
64
68
|
```bash
|
|
65
69
|
# Run test suite
|
|
66
70
|
uv run pytest
|
|
@@ -72,3 +76,8 @@ uv run ruff format --check .
|
|
|
72
76
|
# Strict typechecking (zero any, strict mode)
|
|
73
77
|
uv run mypy src
|
|
74
78
|
```
|
|
79
|
+
|
|
80
|
+
## Author & Attribution
|
|
81
|
+
|
|
82
|
+
- **Author**: Yuva DevLab (`yuva.devlab@gmail.com`)
|
|
83
|
+
- **License**: MIT
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Enterprise-grade authentication SDK and FastAPI security guards for the Yuva DevLab platform ecosystem.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
|
+
|
|
6
7
|
- **Strict Typing:** 100% type-annotated with `py.typed` marker (PEP 561) and strict mypy compliance.
|
|
7
8
|
- **RS256 JWKS Verification:** Validates DevLab Portal SSO tokens without network overhead using local in-memory public key caching.
|
|
8
9
|
- **M2M API Key Validation:** Authenticates machine-to-machine callers (`dlk_...`) via DevLab Portal API with local TTL caching.
|
|
@@ -10,6 +11,7 @@ Enterprise-grade authentication SDK and FastAPI security guards for the Yuva Dev
|
|
|
10
11
|
- **ASGI Middleware:** Global route protection via `DevLabAuthMiddleware`.
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
14
|
+
|
|
13
15
|
```bash
|
|
14
16
|
# Using uv
|
|
15
17
|
uv add devlab-auth
|
|
@@ -19,6 +21,7 @@ pip install devlab-auth
|
|
|
19
21
|
```
|
|
20
22
|
|
|
21
23
|
## Quickstart (FastAPI)
|
|
24
|
+
|
|
22
25
|
```python
|
|
23
26
|
from fastapi import FastAPI, Depends
|
|
24
27
|
from devlab_auth import AuthPrincipal, get_current_principal, require_role
|
|
@@ -41,6 +44,7 @@ async def admin_purge():
|
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
## Development & Verification
|
|
47
|
+
|
|
44
48
|
```bash
|
|
45
49
|
# Run test suite
|
|
46
50
|
uv run pytest
|
|
@@ -52,3 +56,8 @@ uv run ruff format --check .
|
|
|
52
56
|
# Strict typechecking (zero any, strict mode)
|
|
53
57
|
uv run mypy src
|
|
54
58
|
```
|
|
59
|
+
|
|
60
|
+
## Author & Attribution
|
|
61
|
+
|
|
62
|
+
- **Author**: Yuva DevLab (`yuva.devlab@gmail.com`)
|
|
63
|
+
- **License**: MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yuva-devlab/auth-py",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Universal DevLab Authentication SDK for Python",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "uv build",
|
|
8
|
+
"lint": "uv run --with ruff ruff check .",
|
|
9
|
+
"lint:fix": "uv run --with ruff ruff check --fix .",
|
|
10
|
+
"format": "uv run --with ruff ruff format .",
|
|
11
|
+
"format:check": "uv run --with ruff ruff format --check .",
|
|
12
|
+
"typecheck": "uv run --with mypy --with pydantic --with httpx --with fastapi mypy src",
|
|
13
|
+
"test": "echo 'No tests yet for @yuva-devlab/auth-py (skipping)'",
|
|
14
|
+
"clean": "rm -rf dist .venv .ruff_cache .mypy_cache .pytest_cache"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "devlab-auth"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
description = "Universal DevLab Authentication SDK for Python (RS256 JWKS & M2M API Keys with FastAPI guards)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -61,6 +61,7 @@ warn_unused_ignores = true
|
|
|
61
61
|
warn_return_any = true
|
|
62
62
|
show_error_codes = true
|
|
63
63
|
pretty = true
|
|
64
|
+
enable_error_code = ["deprecated"]
|
|
64
65
|
|
|
65
66
|
[[tool.mypy.overrides]]
|
|
66
67
|
module = "cachetools.*"
|
|
@@ -69,3 +70,11 @@ ignore_missing_imports = true
|
|
|
69
70
|
[[tool.mypy.overrides]]
|
|
70
71
|
module = "jwt.*"
|
|
71
72
|
ignore_missing_imports = true
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
filterwarnings = [
|
|
78
|
+
"error::DeprecationWarning",
|
|
79
|
+
"default::DeprecationWarning",
|
|
80
|
+
]
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"""DevLab Authentication SDK for Python (FastAPI, LangChain, Agents)."""
|
|
2
2
|
|
|
3
3
|
from devlab_auth.client import DevLabAuth
|
|
4
|
+
from devlab_auth.constants import DEFAULT_JWKS_PATH, DEFAULT_OPENID_CONFIG_PATH
|
|
4
5
|
from devlab_auth.jwks import JwksValidator
|
|
5
6
|
from devlab_auth.m2m import M2mApiKeyValidator
|
|
6
7
|
from devlab_auth.models import AuthPrincipal, M2mValidationResult
|
|
7
8
|
|
|
8
9
|
__all__ = [
|
|
10
|
+
"DEFAULT_JWKS_PATH",
|
|
11
|
+
"DEFAULT_OPENID_CONFIG_PATH",
|
|
9
12
|
"AuthPrincipal",
|
|
10
13
|
"DevLabAuth",
|
|
11
14
|
"JwksValidator",
|
|
@@ -6,6 +6,7 @@ from typing import Any
|
|
|
6
6
|
import jwt
|
|
7
7
|
from jwt import PyJWKClient
|
|
8
8
|
|
|
9
|
+
from devlab_auth.constants import DEFAULT_JWKS_PATH
|
|
9
10
|
from devlab_auth.models import AuthPrincipal
|
|
10
11
|
|
|
11
12
|
|
|
@@ -19,7 +20,7 @@ class JwksValidator:
|
|
|
19
20
|
cache_ttl_seconds: int = 3600,
|
|
20
21
|
):
|
|
21
22
|
base_url = portal_url or os.getenv("DEVLAB_PORTAL_API_URL") or "http://localhost:4000"
|
|
22
|
-
self.jwks_uri = jwks_uri or f"{base_url.rstrip('/')}
|
|
23
|
+
self.jwks_uri = jwks_uri or f"{base_url.rstrip('/')}{DEFAULT_JWKS_PATH}"
|
|
23
24
|
self._client = PyJWKClient(self.jwks_uri, cache_jwk_set=True, lifespan=cache_ttl_seconds)
|
|
24
25
|
|
|
25
26
|
def validate_token(self, token: str) -> AuthPrincipal:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|