Skip to content
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

update to msal4.30 + pkce support #1152

Merged
merged 2 commits into from
Apr 22, 2021
Merged

update to msal4.30 + pkce support #1152

merged 2 commits into from
Apr 22, 2021

Conversation

jennyf19
Copy link
Collaborator

@jennyf19 jennyf19 commented Apr 20, 2021

@jmprieur have only tested sign-in (obviously, to start), but thought you might be interested as well.

#470

@@ -151,12 +152,14 @@ internal partial class TokenAcquisition : ITokenAcquisitionInternal
{
var application = GetOrBuildConfidentialClientApplication();

context.TokenEndpointRequest.Parameters.TryGetValue(OAuthConstants.CodeVerifierKey, out string? codeVerifier);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can move this inline, but left for testing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's clear.

Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM @jennyf19
I also tried by overriding usePkce = false in the OpenIdConnectOptions. This requires not removing line 434.

@@ -151,12 +152,14 @@ internal partial class TokenAcquisition : ITokenAcquisitionInternal
{
var application = GetOrBuildConfidentialClientApplication();

context.TokenEndpointRequest.Parameters.TryGetValue(OAuthConstants.CodeVerifierKey, out string? codeVerifier);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's clear.

Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't remove line 434 of src/Microsoft.Identity.Web/WebAppExtensions/MicrosoftIdentityWebAppAuthenticationBuilderExtensions.cs

otherwise

.AddMicrosoftIdentityWebApp()

and then

services.ConfigureOptions<MicrosoftIdentityOptions>(options =>
{
 options.UsePkce = false;
});

would not do the right thing.

@bgavrilMS
Copy link
Member

How do you know that this works?

@jmprieur
Copy link
Collaborator

@bgavrilMS : you run the WebAppCallsWebApi projects and use the todo-list button to call the web API.
When you sign-in, this is used (By default PKCE is enabled in ASP.NET Core 5.0);

The other thing to test is that if you override OpenIdConnectOptions.UsePkce to false, this still works (and it does)

@jennyf19
Copy link
Collaborator Author

@bgavrilMS we discussed thursday, the testing would have to happen in MSAL.NET, which I think you added. I tested it manually, as we discussed, i put a break point and checked the code verifier was included and also checked when it's not. everything would break if it didn't work. I'm not testing cca.GetAuthorizationRequestUrl, as we don't use it.

Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks @jennyf19

@jennyf19 jennyf19 merged commit b93c676 into master Apr 22, 2021
@jennyf19 jennyf19 deleted the jennyf/pkce branch April 22, 2021 16:30
@bgavrilMS
Copy link
Member

@jennyf19 - you have an E2E / Selenium test I believe. Will it use PKCE now?
I am asking if the team needs to manually validate this scenario on every release or if it is covered by existing automation.

@jennyf19
Copy link
Collaborator Author

@bgavrilMS I don't understand what the issue is...? We use PKCE now always, so it just works. Not sure what you are asking.

@tedvanderveen
Copy link

@jennyf19 great work, can we pick it up in a nightly build package or should we wait for next Nuget release?

@jennyf19
Copy link
Collaborator Author

@tedvanderveen i've been focused on getting an enhancement out for handling multiple auth schemes....I will sync with @jmprieur and maybe we'll do a release with this and a few other completed items in 1.10 project board so we aren't holding things up for the larger enhancement work with auth schemes.

@jennyf19
Copy link
Collaborator Author

jennyf19 commented May 1, 2021

@tedvanderveen actually, follow 1.9.2, which will have the PCKE included. We will try to have it out next week (1st week of May).

@tedvanderveen
Copy link

tedvanderveen commented May 3, 2021

@jennyf19 looks like 1.9.2 is ready to roll? 🤞🏽 Great work!

@jennyf19
Copy link
Collaborator Author

jennyf19 commented May 4, 2021

@tedvanderveen 1.9.2 is out. should be on nuget shortly: Included in 1.9.2 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants