auth0-api-python 1.0.0b3__tar.gz → 1.0.0b4__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,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: auth0-api-python
3
- Version: 1.0.0b3
3
+ Version: 1.0.0b4
4
4
  Summary: SDK for verifying access tokens and securing APIs with Auth0, using Authlib.
5
5
  License: MIT
6
6
  Author: Auth0
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Dist: ada-url (>=1.25.0,<2.0.0)
16
17
  Requires-Dist: authlib (>=1.0,<2.0)
17
18
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
18
19
  Requires-Dist: requests (>=2.31.0,<3.0.0)
@@ -26,6 +27,24 @@ It’s intended as a foundation for building more framework-specific integration
26
27
 
27
28
  📚 [Documentation](#documentation) - 🚀 [Getting Started](#getting-started) - 💬 [Feedback](#feedback)
28
29
 
30
+ ## Features & Authentication Schemes
31
+
32
+ This SDK provides comprehensive support for securing APIs with Auth0-issued access tokens:
33
+
34
+ ### **Authentication Schemes**
35
+ - **Bearer Token Authentication** - Traditional OAuth 2.0 Bearer tokens (RS256)
36
+ - **DPoP Authentication** - Enhanced security with Demonstrating Proof-of-Possession (ES256)
37
+ - **Mixed Mode Support** - Seamlessly handles both Bearer and DPoP in the same API
38
+
39
+ ### **Core Features**
40
+ - **Unified Entry Point**: `verify_request()` - automatically detects and validates Bearer or DPoP schemes
41
+ - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS
42
+ - **JWT Validation** - Complete RS256 signature verification with claim validation
43
+ - **DPoP Proof Verification** - Full RFC 9449 compliance with ES256 signature validation
44
+ - **Flexible Configuration** - Support for both "Allowed" and "Required" DPoP modes
45
+ - **Comprehensive Error Handling** - Detailed errors with proper HTTP status codes and WWW-Authenticate headers
46
+ - **Framework Agnostic** - Works with FastAPI, Django, Flask, or any Python web framework
47
+
29
48
  ## Documentation
30
49
 
31
50
  - [Docs Site](https://auth0.com/docs) - explore our docs site and learn more about Auth0.
@@ -100,6 +119,61 @@ decoded_and_verified_token = await api_client.verify_access_token(
100
119
 
101
120
  If the token lacks `my_custom_claim` or fails any standard check (issuer mismatch, expired token, invalid signature), the method raises a `VerifyAccessTokenError`.
102
121
 
122
+ ### 4. DPoP Authentication
123
+
124
+ > [!NOTE]
125
+ > 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.
126
+
127
+ This library supports **DPoP (Demonstrating Proof-of-Possession)** for enhanced security, allowing clients to prove possession of private keys bound to access tokens.
128
+
129
+ #### Allowed Mode (Default)
130
+
131
+ Accepts both Bearer and DPoP tokens - ideal for gradual migration:
132
+
133
+ ```python
134
+ api_client = ApiClient(ApiClientOptions(
135
+ domain="<AUTH0_DOMAIN>",
136
+ audience="<AUTH0_AUDIENCE>",
137
+ dpop_enabled=True, # Default - enables DPoP support
138
+ dpop_required=False # Default - allows both Bearer and DPoP
139
+ ))
140
+
141
+ # Use verify_request() for automatic scheme detection
142
+ result = await api_client.verify_request(
143
+ headers={
144
+ "authorization": "DPoP eyJ0eXAiOiJKV1Q...", # DPoP scheme
145
+ "dpop": "eyJ0eXAiOiJkcG9wK2p3dC...", # DPoP proof
146
+ },
147
+ http_method="GET",
148
+ http_url="https://api.example.com/resource"
149
+ )
150
+ ```
151
+
152
+ #### Required Mode
153
+
154
+ Enforces DPoP-only authentication, rejecting Bearer tokens:
155
+
156
+ ```python
157
+ api_client = ApiClient(ApiClientOptions(
158
+ domain="<AUTH0_DOMAIN>",
159
+ audience="<AUTH0_AUDIENCE>",
160
+ dpop_required=True # Rejects Bearer tokens
161
+ ))
162
+ ```
163
+
164
+ #### Configuration Options
165
+
166
+ ```python
167
+ api_client = ApiClient(ApiClientOptions(
168
+ domain="<AUTH0_DOMAIN>",
169
+ audience="<AUTH0_AUDIENCE>",
170
+ dpop_enabled=True, # Enable/disable DPoP support
171
+ dpop_required=False, # Require DPoP (reject Bearer)
172
+ dpop_iat_leeway=30, # Clock skew tolerance (seconds)
173
+ dpop_iat_offset=300, # Maximum proof age (seconds)
174
+ ))
175
+ ```
176
+
103
177
  ## Feedback
104
178
 
105
179
  ### Contributing
@@ -108,7 +182,7 @@ We appreciate feedback and contribution to this repo! Before you get started, pl
108
182
 
109
183
  - [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
110
184
  - [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
111
- - [This repo's contribution guide](./../../CONTRIBUTING.md)
185
+ - [This repo's contribution guide](https://github.com/auth0/auth0-api-python/CONTRIBUTING.md)
112
186
 
113
187
  ### Raise an issue
114
188
 
@@ -131,5 +205,5 @@ Please do not report security vulnerabilities on the public GitHub issue tracker
131
205
  Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a>
132
206
  </p>
133
207
  <p align="center">
134
- This project is licensed under the MIT license. See the <a href="https://github.com/auth0/auth0-server-python/blob/main/packages/auth0_api_python/LICENSE"> LICENSE</a> file for more info.
208
+ 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.
135
209
  </p>
@@ -6,6 +6,24 @@ It’s intended as a foundation for building more framework-specific integration
6
6
 
7
7
  📚 [Documentation](#documentation) - 🚀 [Getting Started](#getting-started) - 💬 [Feedback](#feedback)
8
8
 
9
+ ## Features & Authentication Schemes
10
+
11
+ This SDK provides comprehensive support for securing APIs with Auth0-issued access tokens:
12
+
13
+ ### **Authentication Schemes**
14
+ - **Bearer Token Authentication** - Traditional OAuth 2.0 Bearer tokens (RS256)
15
+ - **DPoP Authentication** - Enhanced security with Demonstrating Proof-of-Possession (ES256)
16
+ - **Mixed Mode Support** - Seamlessly handles both Bearer and DPoP in the same API
17
+
18
+ ### **Core Features**
19
+ - **Unified Entry Point**: `verify_request()` - automatically detects and validates Bearer or DPoP schemes
20
+ - **OIDC Discovery** - Automatic fetching of Auth0 metadata and JWKS
21
+ - **JWT Validation** - Complete RS256 signature verification with claim validation
22
+ - **DPoP Proof Verification** - Full RFC 9449 compliance with ES256 signature validation
23
+ - **Flexible Configuration** - Support for both "Allowed" and "Required" DPoP modes
24
+ - **Comprehensive Error Handling** - Detailed errors with proper HTTP status codes and WWW-Authenticate headers
25
+ - **Framework Agnostic** - Works with FastAPI, Django, Flask, or any Python web framework
26
+
9
27
  ## Documentation
10
28
 
11
29
  - [Docs Site](https://auth0.com/docs) - explore our docs site and learn more about Auth0.
@@ -80,6 +98,61 @@ decoded_and_verified_token = await api_client.verify_access_token(
80
98
 
81
99
  If the token lacks `my_custom_claim` or fails any standard check (issuer mismatch, expired token, invalid signature), the method raises a `VerifyAccessTokenError`.
82
100
 
101
+ ### 4. DPoP Authentication
102
+
103
+ > [!NOTE]
104
+ > 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.
105
+
106
+ This library supports **DPoP (Demonstrating Proof-of-Possession)** for enhanced security, allowing clients to prove possession of private keys bound to access tokens.
107
+
108
+ #### Allowed Mode (Default)
109
+
110
+ Accepts both Bearer and DPoP tokens - ideal for gradual migration:
111
+
112
+ ```python
113
+ api_client = ApiClient(ApiClientOptions(
114
+ domain="<AUTH0_DOMAIN>",
115
+ audience="<AUTH0_AUDIENCE>",
116
+ dpop_enabled=True, # Default - enables DPoP support
117
+ dpop_required=False # Default - allows both Bearer and DPoP
118
+ ))
119
+
120
+ # Use verify_request() for automatic scheme detection
121
+ result = await api_client.verify_request(
122
+ headers={
123
+ "authorization": "DPoP eyJ0eXAiOiJKV1Q...", # DPoP scheme
124
+ "dpop": "eyJ0eXAiOiJkcG9wK2p3dC...", # DPoP proof
125
+ },
126
+ http_method="GET",
127
+ http_url="https://api.example.com/resource"
128
+ )
129
+ ```
130
+
131
+ #### Required Mode
132
+
133
+ Enforces DPoP-only authentication, rejecting Bearer tokens:
134
+
135
+ ```python
136
+ api_client = ApiClient(ApiClientOptions(
137
+ domain="<AUTH0_DOMAIN>",
138
+ audience="<AUTH0_AUDIENCE>",
139
+ dpop_required=True # Rejects Bearer tokens
140
+ ))
141
+ ```
142
+
143
+ #### Configuration Options
144
+
145
+ ```python
146
+ api_client = ApiClient(ApiClientOptions(
147
+ domain="<AUTH0_DOMAIN>",
148
+ audience="<AUTH0_AUDIENCE>",
149
+ dpop_enabled=True, # Enable/disable DPoP support
150
+ dpop_required=False, # Require DPoP (reject Bearer)
151
+ dpop_iat_leeway=30, # Clock skew tolerance (seconds)
152
+ dpop_iat_offset=300, # Maximum proof age (seconds)
153
+ ))
154
+ ```
155
+
83
156
  ## Feedback
84
157
 
85
158
  ### Contributing
@@ -88,7 +161,7 @@ We appreciate feedback and contribution to this repo! Before you get started, pl
88
161
 
89
162
  - [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
90
163
  - [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
91
- - [This repo's contribution guide](./../../CONTRIBUTING.md)
164
+ - [This repo's contribution guide](https://github.com/auth0/auth0-api-python/CONTRIBUTING.md)
92
165
 
93
166
  ### Raise an issue
94
167
 
@@ -111,5 +184,5 @@ Please do not report security vulnerabilities on the public GitHub issue tracker
111
184
  Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a>
112
185
  </p>
113
186
  <p align="center">
114
- This project is licensed under the MIT license. See the <a href="https://github.com/auth0/auth0-server-python/blob/main/packages/auth0_api_python/LICENSE"> LICENSE</a> file for more info.
187
+ 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.
115
188
  </p>
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "auth0-api-python"
3
- version = "1.0.0.b3"
3
+ version = "1.0.0.b4"
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,6 +15,7 @@ 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.25.0"
18
19
 
19
20
  [tool.poetry.group.dev.dependencies]
20
21
  pytest = "^8.0"
@@ -22,7 +23,7 @@ pytest-cov = "^4.0"
22
23
  pytest-asyncio = "^0.20.3"
23
24
  pytest-mock = "^3.14.0"
24
25
  pytest-httpx = "^0.35.0"
25
- twine = "^6.1.0"
26
+ ruff = "^0.1.0"
26
27
 
27
28
  [tool.pytest.ini_options]
28
29
  addopts = "--cov=src --cov-report=term-missing:skip-covered --cov-report=xml"
@@ -11,4 +11,4 @@ from .config import ApiClientOptions
11
11
  __all__ = [
12
12
  "ApiClient",
13
13
  "ApiClientOptions"
14
- ]
14
+ ]