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
https://datatracker.ietf.org/doc/html/rfc9449[RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP)] is an application-level mechanism for sender-constraining an access token.
356
+
357
+
The primary goal of DPoP is to prevent unauthorized or illegitimate clients from using leaked or stolen access tokens, by binding an access token to a public key upon issuance by the authorization server and requiring that the client proves possession of the corresponding private key when using the access token at the resource server.
358
+
359
+
Access tokens that are sender-constrained via DPoP stand in contrast to the typical bearer token, which can be used by any client in possession of the access token.
360
+
361
+
DPoP introduces the concept of a https://datatracker.ietf.org/doc/html/rfc9449#name-dpop-proof-jwts[DPoP Proof], which is a JWT created by the client and sent as a header in an HTTP request.
362
+
A client uses a DPoP proof to prove the possession of a private key corresponding to a certain public key.
363
+
364
+
When the client initiates an access token request, it attaches a DPoP proof to the request in an HTTP header.
365
+
The authorization server binds (sender-constrains) the access token to the public key associated in the DPoP proof.
366
+
367
+
When the client initiates a protected resource request, it again attaches a DPoP proof to the request in an HTTP header.
368
+
369
+
The resource server obtains information about the public key bound to the access token, either directly in the access token (JWT) or via the <<oauth2-token-introspection-endpoint,OAuth2 Token Introspection endpoint>>.
370
+
The resource server then verifies that the public key bound to the access token matches the public key in the DPoP proof.
371
+
It also verifies that the access token hash in the DPoP proof matches the access token in the request.
To request an access token that is bound to a public key using DPoP, the client MUST provide a valid DPoP proof in the `DPoP` header when making an access token request to the OAuth2 Token endpoint.
377
+
This is applicable for all access token requests regardless of authorization grant type (e.g. `authorization_code`, `refresh_token`, `client_credentials`, etc).
378
+
379
+
The following HTTP request shows an `authorization_code` access token request with a DPoP proof in the `DPoP` header:
After the authorization server successfully validates the DPoP proof, the public key from the DPoP proof will be bound (sender-constrained) to the issued access token.
444
+
445
+
The following access token response shows the `token_type` parameter as `DPoP` to signal to the client that the access token was bound to its DPoP proof public key:
Resource servers MUST be able to identify whether an access token is DPoP-bound and verify the binding to the public key of the DPoP proof.
464
+
The binding is accomplished by associating the public key with the access token in a way that can be accessed by the resource server, such as embedding the public key hash in the access token directly (JWT) or through token introspection.
465
+
466
+
When an access token is represented as a JWT, the public key hash is contained in the `jkt` claim under the confirmation method (`cnf`) claim.
467
+
468
+
The following example shows the claims of a JWT access token containing a `cnf` claim with a `jkt` claim, which is the JWK SHA-256 Thumbprint of the DPoP proof public key:
Copy file name to clipboardExpand all lines: oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/DPoPProofVerifier.java
Copy file name to clipboardExpand all lines: oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/token/OAuth2TokenContext.java
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,7 @@
45
45
publicinterfaceOAuth2TokenContextextendsContext {
46
46
47
47
/**
48
+
* The key used for the DPoP Proof {@link Jwt} (if available).
0 commit comments