-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Identity] [localhost to cloud proposal] @azure/identity-web #20772
Conversation
// Licensed under the MIT license. | ||
|
||
import { MsalAuthorizationCode } from "../../identity/src/msal/nodeFlows/msalAuthorizationCode"; | ||
import { MsalFlow } from "../../identity/src/msal/flows"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering let's avoid taking dependencies on source files. Let's import these from what we have exported publicly from identity package. Else we might run into similar issues as the plugin packages. @sadasant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid this is to either copy the code or to make the separate “common” repo that you were working on. To make this PR simpler, I will keep Will’s approach for now.
@jasonnutter brought to me the concern that naming this library and credential “Web” might be confusing as Microsoft already has https://github.com/AzureAD/microsoft-identity-web |
const state = session.username; // or ID | ||
|
||
// Make sure to redirect to this URI to trigger the Authentication Code Flow: | ||
const authorizeUrl = credential.getRedirectUri(scope, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Based on feedback from @willmtemple and @KarishmaGhiya )
Use something similar to this: https://github.com/Azure/azure-sdk-for-js/pull/21028/files#diff-1f63193b2eb9f68e6353d08afcd823edf160f469d3c70c37d6631f98e052ece6R324
The question is: Should our clients expose a scope? If so, it would be much easier for our users to discover the scopes needed to authenticate with different clients:
const client = new ServiceBusClient(serviceBusEndpoint, credential);
const scopes = client.scopes;
await credential.authenticate(scopes);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jose suggested - client.authenticationOptions = {scopes: []}
const credential = new WebRedirectCredential( | ||
tenantId, | ||
clientId, | ||
redirectUri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Mention that this redirect URI should match the route used in the next snippet, meaning /azureResponse
} | ||
const params = new URLSearchParams(queryParams as Record<string, string>); | ||
const query = params.toString(); | ||
const authorizeHost = `https://login.microsoftonline.com/${this.tenantId}/oauth2/v2.0/authorize?${query}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This login.microsoft.com
most likely changes depending on the cloud.
Feedback from @KarishmaGhiya : Use the authority host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because getAuthorizeUrl(
is part of a credential class, and we’re re-using the code from the main identity package, we can derive the authority host from the MSAL internals, we just need to re-use the code we use there.
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
const state = session.username; // or ID | ||
|
||
// We get the authorize URL. | ||
const authorizeUrl = credential.getRedirectUri(scope, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the code you have this function as getAuthorizeUrl
instead of getRedirectUri
. We need to update all samples to use the correct method name
Co-authored-by: KarishmaGhiya <kghiya8@gmail.com>
43392d5
to
e99488a
Compare
Hi @sadasant. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
Hi @sadasant. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass. |
[Hub Generated] Review request for Microsoft.MachineLearningServices to add version preview/2022-10-01-preview (Azure#20818) * Adds base for updating Microsoft.MachineLearningServices from version preview/2022-06-01-preview to version 2022-10-01-preview * Updates readme * Updates API version in new specs and examples * Registries public preview 2022-10-01-preview (Azure#20200) * Registries public preview 2022-10-01-preview * Fix validation errors * Fix LintDiff and Avocado errors * Fixing prettier errors * Fixing more LintDiff errors * Another LintDiff error * Another Lint error Co-authored-by: Fahd Kamal <fahdk@microsoft.com> * Added schedule api (Azure#20273) * added schedule api * add updateSchedules to examples parent folder * fix typo * change position of allOf * remove subnet from example compute create * after prettier run * Description change for recurrence freq * point to mfe for common objects * add hash operator * removed triggertype as well * change year * get rid of breaking changes since we didn't change the api Co-authored-by: Naman Agarwal <naagarw@microsoft.com> * Added Compute Instance OS Patching Properties (Azure#20284) * Added CI Os Patching related properties * Updated descriptions as per Dennis's suggestions Co-authored-by: Srivatsa Sinha <srsinha@microsoft.com> * Maulik/sync preview (Azure#20554) * Added changes to sync with main * Fixed Prettier Check Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Remove update schedules REST call for compute instance (Azure#20699) * change post call to put * change put to patch * remove updateschedules rest call Co-authored-by: Naman Agarwal <naagarw@microsoft.com> * Update connection type and auth type (Azure#20493) * Update connection type and auth type * update connection category * update x-ms-secret tag * Add autologger_settings for CI (Azure#20302) * Add autologger_settings for CI Add settings to opt-in/out of default mlflow autologger on CIs. * update machinelearningservices.json * Add for command job * fix comma * Add autologger for command job * fix CI failures * Remove mfe.json from PR * Remove whitespace * Update custom-words.txt * Delete incorrect custom-words.txt * Fixing auto-rest issues in registries (Azure#20772) * Fixing auto-rest issues in registries * Removing location from the required list Co-authored-by: Fahd Kamal <fahdk@microsoft.com> * Maulik/mfe preview changes (Azure#20372) * Added mfe.json preview changes * Added resources to Registries and Workspaces folder * removed unwanted resources * removed unwanted resources * Ran prettier check * removed unwanted resources * removed unwanted resources * Added ManagedOnlineDeployment resource * Added files to OnlineDeplyment * Added Model Validation changes * Added mfe.json changes to handle duplicate operation id changes * Updated mfe to fix underscore error * Update title of mfe.json * Renamed name path parameter * Updated examples * Fixed Semantic validations and examples * Fixed Semantic validations and examples * Fixed Semantic validations and examples * Removed name changes from workspaces * Changes related to Model Validation * Changes related to Model validation * Added consumes amd produces in registries.json * Removed changes from registries * Updated parameter mlFlowAutologger to mlflowAutologger in mfe.json * Changed property name to mlflowAutologger Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Updated custom words to resolve merge conflict (Azure#20833) * Updated custom words to resolve merge conflict * Updated custom words to resolve merge conflict Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Resolved merge conflict (Azure#20845) Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Fixed LintDiff checks (Azure#20847) * Fixed LintDiff checks * Fixed LintDiff checks * Fixed LintDiff checks * Fixed LintDiff checks * Updated examples Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Resolved merge conflict of cutsom-words.txt (Azure#20956) * Resolved merge conflict * Resolved merge conflict Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * [Hub Generated] Review request for Microsoft.MachineLearningServices to add version stable/2022-10-01 (Azure#20800) (Azure#20982) * Adds base for updating Microsoft.MachineLearningServices from version stable/2022-05-01 to version 2022-10-01 * Updates readme * Updates API version in new specs and examples * Added readOnly property (Azure#20506) * Added readOnly property * Added changes to sync with main * Fixed Prettier check Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Add schedule related schemas for Compute Instance (Azure#20697) * support for update schedules on Compute Instance * change put to patch * remove update schedules rest call Co-authored-by: Naman Agarwal <naagarw@microsoft.com> * Added mfe.json changes (Azure#20514) * Added mfe.json changes * Added checks related changes * Updated mfe.json to handle online endpoint and deployment changes * Updated mfe.json with AutoRebuild changes Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Removed duplicate definitions and updated with mfe references (Azure#20840) * Removed duplicate definitions and updated with mfe references * Replaced Cron to CronTrigger, Recurrence to RecurrenceTrigger from mfe Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> Co-authored-by: Naman Agarwal <namanag16@gmail.com> Co-authored-by: Naman Agarwal <naagarw@microsoft.com> Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> Co-authored-by: Naman Agarwal <namanag16@gmail.com> Co-authored-by: Naman Agarwal <naagarw@microsoft.com> * Revert "[Hub Generated] Review request for Microsoft.MachineLearningS… (Azure#20983) * Revert "[Hub Generated] Review request for Microsoft.MachineLearningServices to add version stable/2022-10-01 (Azure#20800) (Azure#20982)" This reverts commit 649ef8334aca13558e534babdcf53cef6831f22a. * Updated readme.md to resolve merge conflict Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * Maulik/fix preview (Azure#20994) * Merged readme from main * Added preview tag changes Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> * shuffle readme tags (Azure#21005) * conflict resolution (Azure#21007) Co-authored-by: fahdkmsft <51756016+fahdkmsft@users.noreply.github.com> Co-authored-by: Fahd Kamal <fahdk@microsoft.com> Co-authored-by: Naman Agarwal <namanag16@gmail.com> Co-authored-by: Naman Agarwal <naagarw@microsoft.com> Co-authored-by: srivatsasinha <102133347+srivatsasinha@users.noreply.github.com> Co-authored-by: Srivatsa Sinha <srsinha@microsoft.com> Co-authored-by: maulikjoshi <maulikjoshi@microsoft.com> Co-authored-by: ZhidaLiu <zhili@microsoft.com> Co-authored-by: prakharg-msft <75808410+prakharg-msft@users.noreply.github.com> Co-authored-by: Teddy Todorov <thtodoro@microsoft.com>
This package is a WORK IN PROGRESS.
This PR introduces the
WebRedirectCredential
, a credential that aims to simplify the development of web backend applications, from localhost to the Azure cloud.Before I make the actual proposal, I’ll use this draft PR to ask for feedback, and to build the package for the Playwright-based champion scenarios that I’m making.
Fixes #21045
If you want to try out how the new design looks in comparison to the old design, I’m working on mocked tests here: