-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Identity project noUnusedParameters, noImplicitReturns and noUnusedLocals tsconfig fixes #11453
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
Changes from 7 commits
3887399
432ba01
6dd2c86
f8fb6a8
5fb75dc
8dc31bb
17eacfb
e7f3426
5a08123
525feed
84d7f75
fbc0688
1c57627
18f18b6
afa3697
585a436
68efa0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,9 @@ | |
|
|
||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
|
|
||
| import { TokenCredential, GetTokenOptions, AccessToken } from "@azure/core-http"; | ||
| import { TokenCredential, AccessToken, GetTokenOptions } from "@azure/core-http"; | ||
| import { InteractiveBrowserCredentialOptions } from "./interactiveBrowserCredentialOptions"; | ||
| import { credentialLogger, formatError } from "../util/logging"; | ||
| import { TokenCredentialOptions, IdentityClient } from "../client/identityClient"; | ||
| import { credentialLogger } from "../util/logging"; | ||
| import { DefaultTenantId, DeveloperSignOnClientId } from "../constants"; | ||
| import { Socket } from "net"; | ||
|
|
||
|
|
@@ -15,46 +14,30 @@ const SERVER_PORT = process.env.PORT || 80; | |
| import express from "express"; | ||
| import { PublicClientApplication, TokenCache, AuthorizationCodeRequest } from "@azure/msal-node"; | ||
| import open from "open"; | ||
| import path from "path"; | ||
| import http from "http"; | ||
|
|
||
| const BrowserNotSupportedError = new Error( | ||
| "InteractiveBrowserCredential is not supported in Node.js." | ||
| ); | ||
| const logger = credentialLogger("InteractiveBrowserCredential"); | ||
|
|
||
| interface AuthenticationRecord { | ||
| authority?: string; | ||
| homeAccountId: string; | ||
| environment: string; | ||
| tenantId: string; | ||
| username: string; | ||
| } | ||
|
|
||
| /** | ||
| * Enables authentication to Azure Active Directory inside of the web browser | ||
| * using the interactive login flow, either via browser redirects or a popup | ||
| * window. This credential is not currently supported in Node.js. | ||
| */ | ||
| export class InteractiveBrowserCredential implements TokenCredential { | ||
| private identityClient: IdentityClient; | ||
| private pca: PublicClientApplication; | ||
| private msalCacheManager: TokenCache; | ||
| private tenantId: string; | ||
| private clientId: string; | ||
| private persistenceEnabled: boolean; | ||
| private redirectUri: string; | ||
| private authorityHost: string; | ||
| private authenticationRecord: AuthenticationRecord | undefined; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jonathandturner This was added in #10994
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mohsin Mehmood (@mohsin-mehmood) Looks like the latest changes in the master branch do make use of the |
||
|
|
||
| constructor(options?: InteractiveBrowserCredentialOptions) { | ||
| this.identityClient = new IdentityClient(options); | ||
| this.tenantId = (options && options.tenantId) || DefaultTenantId; | ||
| this.clientId = (options && options.clientId) || DeveloperSignOnClientId; | ||
|
|
||
| // Future update: this is for persistent caching | ||
| this.persistenceEnabled = false; | ||
| this.authenticationRecord = undefined; | ||
|
|
||
| if (options && options.redirectUri) { | ||
| if (typeof options.redirectUri === "string") { | ||
|
|
@@ -100,6 +83,7 @@ export class InteractiveBrowserCredential implements TokenCredential { | |
| */ | ||
| public getToken( | ||
| scopes: string | string[], | ||
| //@ts-ignore | ||
|
mohsin-mehmood marked this conversation as resolved.
Outdated
|
||
| options?: GetTokenOptions | ||
| ): Promise<AccessToken | null> { | ||
| const scopeArray = typeof scopes === "object" ? scopes : [scopes]; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.