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

Move node clients from msal-common to msal-node #5788

Merged
merged 10 commits into from
Mar 31, 2023

Conversation

konstantin-msft
Copy link
Collaborator

@konstantin-msft konstantin-msft commented Mar 13, 2023

  1. Move 4 clients used only by msal-node from msal-common to msal-node.
    • ClientCredentialClient
    • DeviceCodeClient
    • OnBehalfOfClient
    • UsernamePasswordClient
  2. Move request and part of response docs from msal-common to msal-node.
  3. Update references.

@konstantin-msft konstantin-msft changed the base branch from dev to msal-browser-v3 March 13, 2023 15:02
@github-actions github-actions bot added msal-common Related to msal-common package msal-node Related to msal-node package labels Mar 13, 2023
@konstantin-msft konstantin-msft marked this pull request as ready for review March 13, 2023 15:04
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse";
import { IAppTokenProvider } from "../config/AppTokenProvider";
import { UrlString } from "../url/UrlString";
import { ClientConfiguration } from "@azure/msal-common/src/config/ClientConfiguration";
Copy link
Member

Choose a reason for hiding this comment

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

Are we doing package based imports now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No we should not do this, these things should be exported from msal-common if not already.

Copy link
Member

Choose a reason for hiding this comment

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

That is what I thought. And this is common pattern across the board, to export the files from msal-common and not the pre-compiled package. @konstantin-msft why the change??

Copy link
Member

Choose a reason for hiding this comment

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

+1, I think the reason most of these aren't exported already is because none of the client classes were implemented at the wrapper library level. Having to export all of these common classes may be an argument against factoring the confidential clients out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My bad. Fixed imports, thank you.

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.

Please update the import paths

@derisen
Copy link
Contributor

derisen commented Mar 13, 2023

@konstantin-msft think we should probably relocate this doc to msal-node side as well (and maybe rename it to acquire-token while at it?)

@ghost
Copy link

ghost commented Mar 27, 2023

Reminder: The next release is scheduled for next week and this PR appears to be stale :(

If changes have been requested please address feedback.
If this PR is still a work in progress please mark as draft.

@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Mar 27, 2023
@ghost ghost removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Mar 29, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2023

Codecov Report

❗ No coverage uploaded for pull request base (msal-browser-v3@cfd9821). Click here to learn what that means.
The diff coverage is n/a.

Flag Coverage Δ
msal-angular 96.61% <0.00%> (?)
msal-browser 84.13% <0.00%> (?)
msal-common 85.10% <0.00%> (?)
msal-node 80.07% <0.00%> (?)
msal-node-extensions 45.81% <0.00%> (?)
msal-react 94.82% <0.00%> (?)
node-token-validation 87.28% <0.00%> (?)

@github-actions github-actions bot added the documentation Related to documentation. label Mar 31, 2023
@konstantin-msft
Copy link
Collaborator Author

@konstantin-msft think we should probably relocate this doc to msal-node side as well (and maybe rename it to acquire-token while at it?)

That's a very good point. Thank you Dogan!
I have moved request and part of response docs to msal-node. I would suggest keeping naming the same to avoid confusion.

@konstantin-msft
Copy link
Collaborator Author

Please update the import paths

Done.

Copy link
Collaborator

@tnorling tnorling left a comment

Choose a reason for hiding this comment

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

Looks good. Just as a general comment; we've been making a lot of major bumps of common lately (which is fine!) and it seems like with this change msal-node will be taking on an even heavier dependency on msal-common APIs, which were previously abstracted away from it. We recently discussed our versioning strategy with regards to common and it may be time to revisit that and seriously consider some of the ideas folks had (i.e. pin dependencies to a specific version or stop publishing it as a separate package and bundle it in with the public packages)

Copy link
Collaborator

@jo-arroyo jo-arroyo 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 a few formatting comments

@@ -0,0 +1,6 @@
MSAL will return an `AuthenticationResult.ts` object as a response to all acquire token APIs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add heading here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, done

@@ -1,19 +1,36 @@
import { ConfidentialClientApplication } from './../../src/client/ConfidentialClientApplication';
import { ClientConfiguration, AuthorizationCodeClient, RefreshTokenClient, AuthenticationResult, ClientCredentialClient, OnBehalfOfClient, UsernamePasswordClient } from '@azure/msal-common';
import {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Combine imports from src with imports below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

import { PublicClientApplication } from './../../src/client/PublicClientApplication';
import { Configuration, ILoopbackClient, InteractiveRequest } from './../../src/index';
import { PublicClientApplication } from '../../src';
import { Configuration, DeviceCodeClient, ILoopbackClient, InteractiveRequest } from '../../src';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Combine src imports?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

import { ID_TOKEN_CLAIMS, mockAuthenticationResult, TEST_CONSTANTS, TEST_DATA_CLIENT_INFO } from '../utils/TestConstants';
import {
ClientConfiguration, AuthenticationResult, AuthorizationCodeClient, RefreshTokenClient, UsernamePasswordClient,
SilentFlowClient, ProtocolMode, Logger, LogLevel, ClientAuthError, AccountInfo, ServerAuthorizationCodeResponse
ClientConfiguration,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

import { AuthorizationUrlRequest } from "../../src/request/AuthorizationUrlRequest";
import { UsernamePasswordRequest } from '../../src/request/UsernamePasswordRequest';
import { SilentFlowRequest } from '../../src/request/SilentFlowRequest';
import {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@konstantin-msft
Copy link
Collaborator Author

Looks good. Just as a general comment; we've been making a lot of major bumps of common lately (which is fine!) and it seems like with this change msal-node will be taking on an even heavier dependency on msal-common APIs, which were previously abstracted away from it. We recently discussed our versioning strategy with regards to common and it may be time to revisit that and seriously consider some of the ideas folks had (i.e. pin dependencies to a specific version or stop publishing it as a separate package and bundle it in with the public packages)

I would say with this PR msal-node will be taking on additional request/response/cache on msal-common types rather than APIs. Other than that, I totally agree - pinning deps to a specific version sounds like a good idea to me.

@github-actions github-actions bot added the msal-angular Related to @azure/msal-angular package label Mar 31, 2023
@konstantin-msft konstantin-msft enabled auto-merge (squash) March 31, 2023 18:41
@konstantin-msft konstantin-msft dismissed sameerag’s stale review March 31, 2023 18:42

requested changes are already addressed

@konstantin-msft konstantin-msft merged commit 8a82b7c into msal-browser-v3 Mar 31, 2023
@konstantin-msft konstantin-msft deleted the 2441770_migrate_common_to_node branch March 31, 2023 18:42
konstantin-msft added a commit that referenced this pull request Mar 31, 2023
1. Move 4 clients used only by `msal-node` from `msal-common` to
`msal-node`.
    - ClientCredentialClient
    - DeviceCodeClient
    - OnBehalfOfClient
    - UsernamePasswordClient
2. Move `request` and part of `response` docs from `msal-common` to
`msal-node`.
3. Update references.
hectormmg pushed a commit that referenced this pull request Apr 4, 2023
1. Move 4 clients used only by `msal-node` from `msal-common` to
`msal-node`.
    - ClientCredentialClient
    - DeviceCodeClient
    - OnBehalfOfClient
    - UsernamePasswordClient
2. Move `request` and part of `response` docs from `msal-common` to
`msal-node`.
3. Update references.
@ghost
Copy link

ghost commented May 3, 2023

🎉@azure/msal-node@v2.0.0-alpha.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented May 3, 2023

🎉@azure/msal-angular@v3.0.0-alpha.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
documentation Related to documentation. msal-angular Related to @azure/msal-angular package msal-common Related to msal-common package msal-node Related to msal-node package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants