-
Notifications
You must be signed in to change notification settings - Fork 465
Add DPoP (RFC 9449) proof creation and server-side validation #3443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
43fcbaa
Initial prototype for dpop, work in progress
9b85cff
Finalize DPoP implementation
26d62b1
Add net462 tests
88e1bbf
Removing unnecessary net462 guard
b5443d0
Remove keycloack tests and move proof creation to test projects.
c3f8509
Remove prefixes from proof options, after refactoring MISE #2
bcc4727
Add to linux sln and add e2e tests
41da54b
Fix up the namespace
585b3be
Revert unwanted changes, fix up test warning
6997744
Fix up public api for Tokens. Remove unused code.
b320276
Reduce APIs surface visibility -> move to internal
a954bbe
Use utility method instead
9e54daa
Add netstandard2.0 PublicAPI file
9c9a910
Clean up errors and consts
d9a2e94
Remove unncessary $(NoWarn)
368446f
Collapse binding validation into proof validation. Reduce public api …
3626129
Handle server error condition more explicitly.
8b569dc
Restore errorcode property for easier WWWAuthenticate header control …
8beaccc
Address error messaging comments and update tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.IdentityModel.Dpop; | ||
|
|
||
| /// <summary> | ||
| /// DPoP-specific JWT claim type names per RFC 9449. | ||
| /// </summary> | ||
| public static class DPoPClaimTypes | ||
| { | ||
| /// <summary>The HTTP method claim.</summary> | ||
| public const string Htm = "htm"; | ||
|
|
||
| /// <summary>The HTTP URI claim.</summary> | ||
| public const string Htu = "htu"; | ||
|
|
||
| /// <summary>The issued-at timestamp claim.</summary> | ||
| public const string Iat = "iat"; | ||
|
|
||
| /// <summary>The JWT unique identifier claim.</summary> | ||
| public const string Jti = "jti"; | ||
|
|
||
| /// <summary>The access token hash claim.</summary> | ||
| public const string Ath = "ath"; | ||
|
|
||
| /// <summary>The server-provided nonce claim.</summary> | ||
| public const string Nonce = "nonce"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.IdentityModel.Dpop; | ||
|
|
||
| /// <summary> | ||
| /// Constants for DPoP (Demonstrating Proof-of-Possession at the Application Layer) per RFC 9449. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Claim types are in <see cref="DPoPClaimTypes"/>. | ||
| /// Error codes are in <see cref="DPoPErrorCodes"/>. | ||
| /// </remarks> | ||
| public static class DPoPConstants | ||
| { | ||
| /// <summary> | ||
| /// The DPoP token type. | ||
| /// </summary> | ||
| public const string DPoPTokenType = "DPoP"; | ||
|
bgavrilMS marked this conversation as resolved.
|
||
|
|
||
| /// <summary> | ||
| /// The required <c>typ</c> header value for DPoP proof JWTs. | ||
| /// </summary> | ||
| public const string DPoPProofTokenType = "dpop+jwt"; | ||
|
|
||
| /// <summary> | ||
| /// The DPoP nonce HTTP header name. | ||
| /// </summary> | ||
| public const string DPoPNonceHeaderName = "DPoP-Nonce"; | ||
|
MZOLN marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.IdentityModel.Dpop; | ||
|
|
||
| /// <summary> | ||
| /// RFC 9449 error codes for DPoP validation failures. | ||
| /// </summary> | ||
| public static class DPoPErrorCodes | ||
| { | ||
| /// <summary>The server requires a DPoP nonce.</summary> | ||
| public const string UseDPoPNonce = "use_dpop_nonce"; | ||
|
|
||
| /// <summary>The token is invalid.</summary> | ||
| public const string InvalidToken = "invalid_token"; | ||
|
|
||
| /// <summary>The request is invalid (e.g., missing DPoP proof).</summary> | ||
| public const string InvalidRequest = "invalid_request"; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.