auth0-api-python 1.0.0b6__tar.gz → 1.0.0b8__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.
@@ -1,3 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: auth0-api-python
3
+ Version: 1.0.0b8
4
+ Summary: SDK for verifying access tokens and securing APIs with Auth0, using Authlib.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Auth0
8
+ Author-email: support@auth0.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Dist: ada-url (>=1.27.0,<2.0.0) ; python_version == "3.9"
19
+ Requires-Dist: ada-url (>=1.30.0,<2.0.0) ; python_version >= "3.10"
20
+ Requires-Dist: authlib (>=1.0,<2.0)
21
+ Requires-Dist: httpx (>=0.28.1,<0.29.0)
22
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
23
+ Description-Content-Type: text/markdown
24
+
1
25
  The `auth0-api-python` library allows you to secure APIs running on Python, particularly for verifying Auth0-issued access tokens.
2
26
 
3
27
  It’s intended as a foundation for building more framework-specific integrations (e.g., with FastAPI, Django, etc.), but you can also use it directly in any Python server-side environment.
@@ -17,7 +41,8 @@ This SDK provides comprehensive support for securing APIs with Auth0-issued acce
17
41
 
18
42
  ### **Core Features**
19
43
  - **Unified Entry Point**: `verify_request()` - automatically detects and validates Bearer or DPoP schemes
20
- - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS
44
+ - **Multi-Custom Domain (MCD)** - Accept tokens from multiple Auth0 domains with static lists or dynamic resolvers
45
+ - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS with per-issuer caching
21
46
  - **JWT Validation** - Complete RS256 signature verification with claim validation
22
47
  - **DPoP Proof Verification** - Full RFC 9449 compliance with ES256 signature validation
23
48
  - **Flexible Configuration** - Support for both "Allowed" and "Required" DPoP modes
@@ -226,9 +251,6 @@ If the token lacks `my_custom_claim` or fails any standard check (issuer mismatc
226
251
 
227
252
  ### 6. DPoP Authentication
228
253
 
229
- > [!NOTE]
230
- > This feature is currently available in [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access). Please reach out to Auth0 support to get it enabled for your tenant.
231
-
232
254
  This library supports **DPoP (Demonstrating Proof-of-Possession)** for enhanced security, allowing clients to prove possession of private keys bound to access tokens.
233
255
 
234
256
  #### Allowed Mode (Default)
@@ -279,6 +301,50 @@ api_client = ApiClient(ApiClientOptions(
279
301
  ))
280
302
  ```
281
303
 
304
+ ### 7. Multi-Custom Domain (MCD) Support
305
+
306
+ If your Auth0 tenant has multiple custom domains, or you're migrating between domains, the SDK can accept tokens from any of them:
307
+
308
+ #### Static Domain List
309
+
310
+ ```python
311
+ from auth0_api_python import ApiClient, ApiClientOptions
312
+
313
+ api_client = ApiClient(ApiClientOptions(
314
+ domains=[
315
+ "tenant.auth0.com",
316
+ "auth.example.com",
317
+ "auth.acme.org"
318
+ ],
319
+ audience="https://api.example.com"
320
+ ))
321
+
322
+ # Tokens from any of the three domains are accepted
323
+ claims = await api_client.verify_access_token(access_token)
324
+ ```
325
+
326
+ #### Dynamic Resolver
327
+
328
+ For runtime domain resolution based on request context:
329
+
330
+ ```python
331
+ from auth0_api_python import ApiClient, ApiClientOptions, DomainsResolverContext
332
+
333
+ def resolve_domains(context: DomainsResolverContext) -> list[str]:
334
+ # Determine allowed domains based on the request
335
+ return ["tenant.auth0.com", "auth.example.com"]
336
+
337
+ api_client = ApiClient(ApiClientOptions(
338
+ domains=resolve_domains,
339
+ audience="https://api.example.com"
340
+ ))
341
+ ```
342
+
343
+ For hybrid mode (migration scenarios), resolver patterns, error handling, and caching configuration, see the full guides:
344
+
345
+ - **[Multi-Custom Domain Guide](docs/MultipleCustomDomain.md)** - Configuration modes, resolver patterns, migration, error handling
346
+ - **[Caching Guide](docs/Caching.md)** - Cache tuning, custom adapters (Redis, Memcached)
347
+
282
348
  ## Feedback
283
349
 
284
350
  ### Contributing
@@ -311,4 +377,4 @@ Please do not report security vulnerabilities on the public GitHub issue tracker
311
377
  </p>
312
378
  <p align="center">
313
379
  This project is licensed under the MIT license. See the <a href="https://github.com/auth0/auth0-api-python/LICENSE"> LICENSE</a> file for more info.
314
- </p>
380
+ </p>
@@ -1,26 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: auth0-api-python
3
- Version: 1.0.0b6
4
- Summary: SDK for verifying access tokens and securing APIs with Auth0, using Authlib.
5
- License: MIT
6
- License-File: LICENSE
7
- Author: Auth0
8
- Author-email: support@auth0.com
9
- Requires-Python: >=3.9,<4.0
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Programming Language :: Python :: 3.14
18
- Requires-Dist: ada-url (>=1.27.0,<2.0.0)
19
- Requires-Dist: authlib (>=1.0,<2.0)
20
- Requires-Dist: httpx (>=0.28.1,<0.29.0)
21
- Requires-Dist: requests (>=2.31.0,<3.0.0)
22
- Description-Content-Type: text/markdown
23
-
24
1
  The `auth0-api-python` library allows you to secure APIs running on Python, particularly for verifying Auth0-issued access tokens.
25
2
 
26
3
  It’s intended as a foundation for building more framework-specific integrations (e.g., with FastAPI, Django, etc.), but you can also use it directly in any Python server-side environment.
@@ -40,7 +17,8 @@ This SDK provides comprehensive support for securing APIs with Auth0-issued acce
40
17
 
41
18
  ### **Core Features**
42
19
  - **Unified Entry Point**: `verify_request()` - automatically detects and validates Bearer or DPoP schemes
43
- - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS
20
+ - **Multi-Custom Domain (MCD)** - Accept tokens from multiple Auth0 domains with static lists or dynamic resolvers
21
+ - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS with per-issuer caching
44
22
  - **JWT Validation** - Complete RS256 signature verification with claim validation
45
23
  - **DPoP Proof Verification** - Full RFC 9449 compliance with ES256 signature validation
46
24
  - **Flexible Configuration** - Support for both "Allowed" and "Required" DPoP modes
@@ -249,9 +227,6 @@ If the token lacks `my_custom_claim` or fails any standard check (issuer mismatc
249
227
 
250
228
  ### 6. DPoP Authentication
251
229
 
252
- > [!NOTE]
253
- > This feature is currently available in [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access). Please reach out to Auth0 support to get it enabled for your tenant.
254
-
255
230
  This library supports **DPoP (Demonstrating Proof-of-Possession)** for enhanced security, allowing clients to prove possession of private keys bound to access tokens.
256
231
 
257
232
  #### Allowed Mode (Default)
@@ -302,6 +277,50 @@ api_client = ApiClient(ApiClientOptions(
302
277
  ))
303
278
  ```
304
279
 
280
+ ### 7. Multi-Custom Domain (MCD) Support
281
+
282
+ If your Auth0 tenant has multiple custom domains, or you're migrating between domains, the SDK can accept tokens from any of them:
283
+
284
+ #### Static Domain List
285
+
286
+ ```python
287
+ from auth0_api_python import ApiClient, ApiClientOptions
288
+
289
+ api_client = ApiClient(ApiClientOptions(
290
+ domains=[
291
+ "tenant.auth0.com",
292
+ "auth.example.com",
293
+ "auth.acme.org"
294
+ ],
295
+ audience="https://api.example.com"
296
+ ))
297
+
298
+ # Tokens from any of the three domains are accepted
299
+ claims = await api_client.verify_access_token(access_token)
300
+ ```
301
+
302
+ #### Dynamic Resolver
303
+
304
+ For runtime domain resolution based on request context:
305
+
306
+ ```python
307
+ from auth0_api_python import ApiClient, ApiClientOptions, DomainsResolverContext
308
+
309
+ def resolve_domains(context: DomainsResolverContext) -> list[str]:
310
+ # Determine allowed domains based on the request
311
+ return ["tenant.auth0.com", "auth.example.com"]
312
+
313
+ api_client = ApiClient(ApiClientOptions(
314
+ domains=resolve_domains,
315
+ audience="https://api.example.com"
316
+ ))
317
+ ```
318
+
319
+ For hybrid mode (migration scenarios), resolver patterns, error handling, and caching configuration, see the full guides:
320
+
321
+ - **[Multi-Custom Domain Guide](docs/MultipleCustomDomain.md)** - Configuration modes, resolver patterns, migration, error handling
322
+ - **[Caching Guide](docs/Caching.md)** - Cache tuning, custom adapters (Redis, Memcached)
323
+
305
324
  ## Feedback
306
325
 
307
326
  ### Contributing
@@ -334,4 +353,4 @@ Please do not report security vulnerabilities on the public GitHub issue tracker
334
353
  </p>
335
354
  <p align="center">
336
355
  This project is licensed under the MIT license. See the <a href="https://github.com/auth0/auth0-api-python/LICENSE"> LICENSE</a> file for more info.
337
- </p>
356
+ </p>
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "auth0-api-python"
3
- version = "1.0.0.b6"
3
+ version = "1.0.0b8"
4
4
  description = "SDK for verifying access tokens and securing APIs with Auth0, using Authlib."
5
5
  authors = ["Auth0 <support@auth0.com>"]
6
6
  license = "MIT"
@@ -15,7 +15,10 @@ python = "^3.9"
15
15
  authlib = "^1.0" # For JWT/OIDC features
16
16
  requests = "^2.31.0" # If you use requests for HTTP calls (e.g., discovery)
17
17
  httpx = "^0.28.1"
18
- ada-url = "^1.27.0"
18
+ ada-url = [
19
+ {version = "^1.30.0", python = ">=3.10"},
20
+ {version = "^1.27.0", python = ">=3.9,<3.10"}
21
+ ]
19
22
 
20
23
  [tool.poetry.group.dev.dependencies]
21
24
  pytest = "^8.0"
@@ -23,7 +26,7 @@ pytest-cov = "^4.0"
23
26
  pytest-asyncio = "^0.25.3"
24
27
  pytest-mock = "^3.15.1"
25
28
  pytest-httpx = "^0.35.0"
26
- ruff = ">=0.1,<0.15"
29
+ ruff = ">=0.1"
27
30
  freezegun = "^1.5.5"
28
31
 
29
32
  [tool.pytest.ini_options]
@@ -0,0 +1,30 @@
1
+ """
2
+ auth0-api-python
3
+
4
+ A lightweight Python SDK for verifying Auth0-issued access tokens
5
+ in server-side APIs, using Authlib for OIDC discovery and JWKS fetching.
6
+ """
7
+
8
+ from .api_client import ApiClient
9
+ from .cache import CacheAdapter, InMemoryCache
10
+ from .config import ApiClientOptions
11
+ from .errors import (
12
+ ApiError,
13
+ ConfigurationError,
14
+ DomainsResolverError,
15
+ GetTokenByExchangeProfileError,
16
+ )
17
+ from .types import DomainsResolver, DomainsResolverContext
18
+
19
+ __all__ = [
20
+ "ApiClient",
21
+ "ApiClientOptions",
22
+ "ApiError",
23
+ "CacheAdapter",
24
+ "ConfigurationError",
25
+ "DomainsResolver",
26
+ "DomainsResolverContext",
27
+ "DomainsResolverError",
28
+ "GetTokenByExchangeProfileError",
29
+ "InMemoryCache",
30
+ ]