-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add PKCE support in OIDC & OAuth #10928
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
8 commits
Select commit
Hold shift + click to select a range
8be2708
Implement PKCE for OIDC #7734
Tratcher 1431432
Add IdentityServer samples
Tratcher 7840a63
OAuth PKCE #7734
Tratcher 3484254
Ref assemblies
Tratcher 9e42879
Typo, constants
Tratcher 7864b08
Code only
Tratcher 3548190
Refs ~!@@~~
Tratcher 83289f0
Remove GenerateUniqueId. Move OAuthCodeExchangeContext.
Tratcher 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
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
39 changes: 39 additions & 0 deletions
39
src/Security/Authentication/OAuth/src/OAuthCodeExchangeContext.cs
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,39 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.AspNetCore.Authentication.OAuth | ||
{ | ||
/// <summary> | ||
/// Contains information used to perform the code exchange. | ||
/// </summary> | ||
public class OAuthCodeExchangeContext | ||
{ | ||
/// <summary> | ||
/// Initializes a new <see cref="OAuthCodeExchangeContext"/>. | ||
/// </summary> | ||
/// <param name="properties">The <see cref="AuthenticationProperties"/>.</param> | ||
/// <param name="code">The code returned from the authorization endpoint.</param> | ||
/// <param name="redirectUri">The redirect uri used in the authorization request.</param> | ||
public OAuthCodeExchangeContext(AuthenticationProperties properties, string code, string redirectUri) | ||
{ | ||
Properties = properties; | ||
Code = code; | ||
RedirectUri = redirectUri; | ||
} | ||
|
||
/// <summary> | ||
/// State for the authentication flow. | ||
/// </summary> | ||
public AuthenticationProperties Properties { get; } | ||
|
||
/// <summary> | ||
/// The code returned from the authorization endpoint. | ||
/// </summary> | ||
public string Code { get; } | ||
|
||
/// <summary> | ||
/// The redirect uri used in the authorization request. | ||
/// </summary> | ||
public string RedirectUri { get; } | ||
} | ||
} |
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,31 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.AspNetCore.Authentication.OAuth | ||
{ | ||
/// <summary> | ||
/// Constants used in the OAuth protocol | ||
/// </summary> | ||
public static class OAuthConstants | ||
{ | ||
/// <summary> | ||
/// code_verifier defined in https://tools.ietf.org/html/rfc7636 | ||
/// </summary> | ||
public static readonly string CodeVerifierKey = "code_verifier"; | ||
|
||
/// <summary> | ||
/// code_challenge defined in https://tools.ietf.org/html/rfc7636 | ||
/// </summary> | ||
public static readonly string CodeChallengeKey = "code_challenge"; | ||
|
||
/// <summary> | ||
/// code_challenge_method defined in https://tools.ietf.org/html/rfc7636 | ||
/// </summary> | ||
public static readonly string CodeChallengeMethodKey = "code_challenge_method"; | ||
|
||
/// <summary> | ||
/// S256 defined in https://tools.ietf.org/html/rfc7636 | ||
/// </summary> | ||
public static readonly string CodeChallengeMethodS256 = "S256"; | ||
} | ||
} |
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
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
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
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.