Commit db19910
committed
fix: Resolve DPoP authentication syntax errors after rebase
Fixed critical syntax and implementation errors in the DPoP (Demonstrating
Proof-of-Possession) authentication flow that were introduced during the
master branch rebase. All 11 integration tests now pass successfully against
a live Okta org.
## Issues Fixed
### 1. Missing Logger Import (okta/oauth.py)
- Added missing `import logging` and logger initialization
- Resolved 7 "Unresolved reference 'logger'" errors
- Added `import json` for response parsing
### 2. DPoP Proof Header Not Sent (okta/oauth.py)
- Fixed headers dict being overwritten in token requests
- DPoP proof now correctly included in OAuth token endpoint calls
- Ensures proper DPoP header transmission to authorization server
### 3. Nonce Challenge Handling (okta/oauth.py)
- Added JSON parsing for response body before error checking
- Fixed detection of `use_dpop_nonce` error from server
- Implemented proper retry logic with nonce (RFC 9449 Section 8)
- Added null-safety check for res_details
### 4. Cache Method Calls (okta/oauth.py)
- Changed `cache.set()` to `cache.add()` (correct API)
- Fixed AttributeError: 'NoOpCache' object has no attribute 'set'
- Updated both OKTA_ACCESS_TOKEN and OKTA_TOKEN_TYPE caching
### 5. API Client Token Handling (okta/api_client.py)
- Changed `configuration["client"]["token"]` to use `.get()` method
- Handles PrivateKey authorization mode where token may be absent
- Prevents KeyError when token is not provided
### 6. Removed Unused Imports (okta/oauth.py)
- Removed unused `urlencode` and `quote` from urllib.parse
- Cleaned up import statements for better code quality
## Validation
- No syntax errors (verified with py_compile)
- No runtime errors
- Token type correctly returned as "DPoP"
- Nonce challenge handling works automatically
- API requests succeed with DPoP-bound tokens
- Thread-safe concurrent request handling verified
## Related
- Implements DPoP authentication per RFC 9449
- Follows .NET SDK implementation pattern
- Based on technical design: eng-Technical Design_DPoP Proof JWTs in Backend SDKs.pdf1 parent a4004d2 commit db19910
2 files changed
Lines changed: 29 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| |||
153 | 161 | | |
154 | 162 | | |
155 | 163 | | |
156 | | - | |
157 | | - | |
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
| |||
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
172 | | - | |
| 178 | + | |
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
177 | 183 | | |
178 | 184 | | |
179 | 185 | | |
180 | | - | |
| 186 | + | |
181 | 187 | | |
182 | 188 | | |
183 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
184 | 197 | | |
185 | 198 | | |
186 | 199 | | |
187 | 200 | | |
188 | 201 | | |
189 | 202 | | |
190 | | - | |
| 203 | + | |
191 | 204 | | |
192 | 205 | | |
193 | 206 | | |
| |||
204 | 217 | | |
205 | 218 | | |
206 | 219 | | |
207 | | - | |
208 | | - | |
| 220 | + | |
| 221 | + | |
209 | 222 | | |
210 | 223 | | |
211 | 224 | | |
| |||
0 commit comments