@microsoft/vscode-azext-azureauth 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,23 @@ import type { TenantIdDescription } from '@azure/arm-resources-subscriptions';
|
|
|
2
2
|
import { Event } from 'vscode';
|
|
3
3
|
import { AzureSubscription } from './AzureSubscription';
|
|
4
4
|
import { AzureSubscriptionProvider } from './AzureSubscriptionProvider';
|
|
5
|
-
export
|
|
5
|
+
export interface AzureDevOpsSubscriptionProviderInitializer {
|
|
6
|
+
/**
|
|
7
|
+
* The resource ID of the Azure DevOps federated service connection,
|
|
8
|
+
* which can be found on the `resourceId` field of the URL at the address bar
|
|
9
|
+
* when viewing the service connection in the Azure DevOps portal
|
|
10
|
+
*/
|
|
11
|
+
serviceConnectionId: string;
|
|
12
|
+
/**
|
|
13
|
+
* The `Tenant ID` field of the service connection properties
|
|
14
|
+
*/
|
|
15
|
+
domain: string;
|
|
16
|
+
/**
|
|
17
|
+
* The `Service Principal Id` field of the service connection properties
|
|
18
|
+
*/
|
|
19
|
+
clientId: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function createAzureDevOpsSubscriptionProviderFactory(initializer: AzureDevOpsSubscriptionProviderInitializer): () => Promise<AzureDevOpsSubscriptionProvider>;
|
|
6
22
|
/**
|
|
7
23
|
* AzureSubscriptionProvider implemented to authenticate via federated DevOps service connection, using workflow identity federation
|
|
8
24
|
* To learn how to configure your DevOps environment to use this provider, refer to the README.md
|
|
@@ -25,7 +41,7 @@ export declare class AzureDevOpsSubscriptionProvider implements AzureSubscriptio
|
|
|
25
41
|
* The `Service Principal Id` field of the service connection properties
|
|
26
42
|
*/
|
|
27
43
|
private _CLIENT_ID;
|
|
28
|
-
constructor();
|
|
44
|
+
constructor({ serviceConnectionId, domain, clientId }: AzureDevOpsSubscriptionProviderInitializer);
|
|
29
45
|
getSubscriptions(_filter: boolean): Promise<AzureSubscription[]>;
|
|
30
46
|
isSignedIn(): Promise<boolean>;
|
|
31
47
|
signIn(): Promise<boolean>;
|
|
@@ -24,9 +24,9 @@ exports.AzureDevOpsSubscriptionProvider = exports.createAzureDevOpsSubscriptionP
|
|
|
24
24
|
const vscode_1 = require("vscode");
|
|
25
25
|
const configuredAzureEnv_1 = require("./utils/configuredAzureEnv");
|
|
26
26
|
let azureDevOpsSubscriptionProvider;
|
|
27
|
-
function createAzureDevOpsSubscriptionProviderFactory() {
|
|
27
|
+
function createAzureDevOpsSubscriptionProviderFactory(initializer) {
|
|
28
28
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
azureDevOpsSubscriptionProvider !== null && azureDevOpsSubscriptionProvider !== void 0 ? azureDevOpsSubscriptionProvider : (azureDevOpsSubscriptionProvider = new AzureDevOpsSubscriptionProvider());
|
|
29
|
+
azureDevOpsSubscriptionProvider !== null && azureDevOpsSubscriptionProvider !== void 0 ? azureDevOpsSubscriptionProvider : (azureDevOpsSubscriptionProvider = new AzureDevOpsSubscriptionProvider(initializer));
|
|
30
30
|
return azureDevOpsSubscriptionProvider;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -38,22 +38,20 @@ exports.createAzureDevOpsSubscriptionProviderFactory = createAzureDevOpsSubscrip
|
|
|
38
38
|
* Reference: https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation
|
|
39
39
|
*/
|
|
40
40
|
class AzureDevOpsSubscriptionProvider {
|
|
41
|
-
constructor() {
|
|
41
|
+
constructor({ serviceConnectionId, domain, clientId }) {
|
|
42
42
|
this.onDidSignIn = () => { return new vscode_1.Disposable(() => { }); };
|
|
43
43
|
this.onDidSignOut = () => { return new vscode_1.Disposable(() => { }); };
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
process.env.AzCodeServiceConnectionClientID: ${CLIENT_ID ? "✅" : "❌"}\n
|
|
52
|
-
`);
|
|
44
|
+
if (!serviceConnectionId || !domain || !clientId) {
|
|
45
|
+
throw new Error(`Missing initializer values to identify Azure DevOps federated service connection\n
|
|
46
|
+
Values provided:\n
|
|
47
|
+
serviceConnectionId: ${serviceConnectionId ? "✅" : "❌"}\n
|
|
48
|
+
domain: ${domain ? "✅" : "❌"}\n
|
|
49
|
+
clientId: ${clientId ? "✅" : "❌"}\n
|
|
50
|
+
`);
|
|
53
51
|
}
|
|
54
|
-
this._SERVICE_CONNECTION_ID =
|
|
55
|
-
this._DOMAIN =
|
|
56
|
-
this._CLIENT_ID =
|
|
52
|
+
this._SERVICE_CONNECTION_ID = serviceConnectionId;
|
|
53
|
+
this._DOMAIN = domain;
|
|
54
|
+
this._CLIENT_ID = clientId;
|
|
57
55
|
}
|
|
58
56
|
getSubscriptions(_filter) {
|
|
59
57
|
return __awaiter(this, void 0, void 0, function* () {
|