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

[msal-browser] Adding exports and other changes for extensibility #4459

Merged
merged 5 commits into from Feb 4, 2022

Conversation

pkanher617
Copy link
Contributor

This PR adds additional exported files and other changes to further support extensibility in other libraries.

@github-actions github-actions bot added the msal-browser Related to msal-browser package label Jan 28, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2022

Codecov Report

Merging #4459 (e86d7f7) into dev (dc27ea9) will not change coverage.
The diff coverage is 100.00%.

Flag Coverage Δ *Carryforward flag
msal-angular 96.39% <ø> (ø)
msal-browser 87.50% <100.00%> (ø) Carriedforward from dc27ea9
msal-common 85.37% <ø> (ø) Carriedforward from dc27ea9
msal-core 82.65% <ø> (ø) Carriedforward from dc27ea9
msal-node 82.97% <ø> (ø) Carriedforward from dc27ea9
msal-node-extensions 76.03% <ø> (ø) Carriedforward from dc27ea9
msal-react 92.70% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
lib/msal-browser/src/app/ClientApplication.ts 96.29% <ø> (ø)
...ser/src/interaction_client/SilentAuthCodeClient.ts 79.31% <ø> (ø)
...owser/src/interaction_client/SilentIframeClient.ts 91.42% <ø> (ø)
...rc/interaction_client/StandardInteractionClient.ts 98.87% <ø> (ø)
...ib/msal-browser/src/app/PublicClientApplication.ts 100.00% <100.00%> (ø)
lib/msal-browser/src/cache/BrowserCacheManager.ts 93.03% <100.00%> (ø)
lib/msal-browser/src/index.ts 100.00% <100.00%> (ø)
...er/src/interaction_client/BaseInteractionClient.ts 98.03% <100.00%> (ø)
...msal-browser/src/interaction_client/PopupClient.ts 100.00% <100.00%> (ø)
...l-browser/src/interaction_client/RedirectClient.ts 100.00% <100.00%> (ø)
... and 8 more

Copy link
Contributor

@peterzenz peterzenz left a comment

Choose a reason for hiding this comment

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

Please confirm the changes that don't match the extensibility changes are not regressions before committing.

lib/msal-browser/src/interaction_client/RedirectClient.ts Outdated Show resolved Hide resolved
@@ -250,8 +249,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
}
}

this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority, validatedRequest.loginHint || "", validatedRequest.account || null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Changes in this file, like the RedirectClient.ts look unrelated to the intent of the PR, maybe you need to re-sync with other updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updating cache entries is part of the "extensiblity" changes, those are now done in their respective interaction handlers

@@ -106,7 +106,8 @@ export enum ApiId {
export enum InteractionType {
Redirect = "redirect",
Popup = "popup",
Silent = "silent"
Silent = "silent",
None = "none"
Copy link
Contributor

Choose a reason for hiding this comment

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

This change also looks unrelated to the intent of your PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also related to enums available for downstream packages

@@ -44,6 +44,7 @@ export class SilentIframeClient extends StandardInteractionClient {
...request,
prompt: PromptValue.NONE
}, InteractionType.Silent);
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we put this in initializeAuthorizationRequest?

Can you also explain what this is for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to update temporary cache values. Using InitializeAuthorizationRequest makes it harder to control when the cache values are updated. For some broker scenarios, we don't want to update cache entries when we initialize the request, but after we send the request up to the broker.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see now that's where it used to be... Can we add a comment explaining this? This feels like something that may get moved back at some point without realizing what it affects. Not sure I like taking a dependency on implementation details like this

Copy link
Member

Choose a reason for hiding this comment

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

I have the same inclination that this may get "optimized" at some point.

Least case add a comment, Best case make a commented helper API with instructions regarding the sequence ,
processReqBeforeDispatch(browserStorage, request: BaseReqType).

May prevent someone moving this later that way and any other functionality we may add before request dispatch for broker. Could be an overkill, will let you do the trade off.

@@ -44,6 +44,7 @@ export class SilentIframeClient extends StandardInteractionClient {
...request,
prompt: PromptValue.NONE
}, InteractionType.Silent);
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
Copy link
Member

Choose a reason for hiding this comment

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

nit: Should we replace "" with Constants.EMPTY_STRING?

Copy link
Member

@sameerag sameerag left a comment

Choose a reason for hiding this comment

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

Approved with comments

@pkanher617 pkanher617 merged commit 2e26302 into dev Feb 4, 2022
@pkanher617 pkanher617 deleted the msal-1p-changes branch February 4, 2022 21:25
@ghost
Copy link

ghost commented Feb 8, 2022

🎉@azure/msal-browser@v2.22.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-browser Related to msal-browser package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants