You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -118,7 +114,7 @@ Accepts both Bearer and DPoP tokens:
118
114
auth0:
119
115
domain: "your-tenant.auth0.com"
120
116
audience: "https://api.example.com"
121
-
dpopMode: ALLOWED # Default value
117
+
dpop-mode: ALLOWED
122
118
```
123
119
124
120
#### 2. Required Mode
@@ -129,7 +125,7 @@ Only accepts DPoP tokens:
129
125
auth0:
130
126
domain: "your-tenant.auth0.com"
131
127
audience: "https://api.example.com"
132
-
dpopMode: REQUIRED
128
+
dpop-mode: REQUIRED
133
129
```
134
130
135
131
#### 3. Disabled Mode
@@ -140,7 +136,7 @@ Only accepts Bearer tokens:
140
136
auth0:
141
137
domain: "your-tenant.auth0.com"
142
138
audience: "https://api.example.com"
143
-
dpopMode: DISABLED
139
+
dpop-mode: DISABLED
144
140
```
145
141
146
142
### Advanced DPoP Configuration
@@ -149,120 +145,137 @@ auth0:
149
145
auth0:
150
146
domain: "your-tenant.auth0.com"
151
147
audience: "https://api.example.com"
152
-
dpopMode: ALLOWED
153
-
dpopIatOffsetSeconds: 300 # DPoP proof time window (default: 300)
154
-
dpopIatLeewaySeconds: 30 # DPoP proof time leeway (default: 30)
148
+
dpop-mode: ALLOWED
149
+
dpop-iat-offset-seconds: 300 # DPoP proof time window (default: 300)
150
+
dpop-iat-leeway-seconds: 30 # DPoP proof time leeway (default: 30)
155
151
```
156
152
157
-
### DPoP-Token Controller
153
+
### How DPoP Works in Your Controllers
154
+
155
+
DPoP validation is handled entirely by the library at the filter level. Your controllers don't need any DPoP-specific code — the library validates the DPoP proof automatically before the request reaches your controller. A validated DPoP request produces the same `Auth0AuthenticationToken` as a Bearer request:
158
156
159
157
```java
160
158
@RestController
161
159
@RequestMapping("/api")
162
-
public class DPoPController {
160
+
public class SensitiveDataController {
163
161
164
162
@GetMapping("/sensitive")
165
-
public ResponseEntity<Map<String, Object>> sensitiveEndpoint(
166
-
Authentication authentication,
167
-
HttpServletRequest request
168
-
) {
169
-
if (authentication instanceof Auth0AuthenticationToken) {
The difference is in what the library **rejects**:
180
+
- `ALLOWED` mode: Accepts both `Authorization: Bearer <token>` and `Authorization: DPoP <token>` + `DPoP: <proof>`
181
+
- `REQUIRED` mode: Rejects Bearer tokens — only `DPoP` tokens with a valid proof are accepted
182
+
- `DISABLED` mode: Rejects DPoP tokens — only `Bearer` tokens are accepted
183
+
193
184
## Scope-Based Authorization
194
185
195
-
### Method-Level Security
186
+
The library maps JWT scopes to Spring Security authorities with a `SCOPE_` prefix. For example, a token with `scope: "read:messages write:messages"` produces authorities `SCOPE_read:messages` and `SCOPE_write:messages`.
187
+
188
+
### Option 1: Security Filter Chain (Recommended)
189
+
190
+
The simplest approach — define scope requirements in your security configuration:
@@ -299,22 +312,23 @@ You can also configure using environment variables:
299
312
```bash
300
313
AUTH0_DOMAIN=your-tenant.auth0.com
301
314
AUTH0_AUDIENCE=https://api.example.com
302
-
AUTH0_DPOP_MODE=ALLOWED
303
-
AUTH0_DPOP_IAT_OFFSET_SECONDS=300
304
-
AUTH0_DPOP_IAT_LEEWAY_SECONDS=30
315
+
AUTH0_DPOPMODE=ALLOWED
316
+
AUTH0_DPOPIATOFFSETSECONDS=300
317
+
AUTH0_DPOPIATLEEWAYSSECONDS=30
305
318
```
306
319
320
+
> **Note:** Spring Boot environment variable binding removes dashes and is case-insensitive. Do not use underscores to separate words within a property name (e.g., use `AUTH0_DPOPMODE`, not `AUTH0_DPOP_MODE`).
321
+
307
322
## Error Handling
308
323
309
324
### Common HTTP Status Codes
310
325
311
326
- **401 Unauthorized**: Missing or invalid token
312
327
- **403 Forbidden**: Valid token but insufficient permissions
313
-
- **400 Bad Request**: Invalid DPoP proof or malformed request
314
328
315
329
### WWW-Authenticate Headers
316
330
317
-
The library automatically sets appropriate `WWW-Authenticate` headers:
331
+
The library automatically sets appropriate `WWW-Authenticate` headers on authentication failures:
0 commit comments