@fluidframework/azure-client 2.1.0-276326 → 2.1.0-281041
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.
- package/README.md +72 -25
- package/api-extractor/{api-extractor-lint-beta.cjs.json → api-extractor.current.json} +2 -2
- package/api-extractor/api-extractor.legacy.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/azure-client.beta.api.md +0 -4
- package/api-report/azure-client.legacy.alpha.api.md +0 -2
- package/api-report/azure-client.legacy.public.api.md +95 -0
- package/api-report/azure-client.public.api.md +0 -4
- package/dist/AzureClient.d.ts +2 -1
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +16 -16
- package/dist/AzureClient.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +7 -1
- package/dist/public.d.ts +7 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/AzureClient.d.ts +2 -1
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +16 -16
- package/lib/AzureClient.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +7 -1
- package/lib/public.d.ts +7 -1
- package/package.json +37 -43
- package/src/AzureClient.ts +26 -26
- package/src/index.ts +0 -1
- package/api-extractor/api-extractor-lint-beta.esm.json +0 -5
- package/beta.d.ts +0 -11
- package/dist/AzureFunctionTokenProvider.d.ts +0 -29
- package/dist/AzureFunctionTokenProvider.d.ts.map +0 -1
- package/dist/AzureFunctionTokenProvider.js +0 -55
- package/dist/AzureFunctionTokenProvider.js.map +0 -1
- package/dist/beta.d.ts +0 -30
- package/lib/AzureFunctionTokenProvider.d.ts +0 -29
- package/lib/AzureFunctionTokenProvider.d.ts.map +0 -1
- package/lib/AzureFunctionTokenProvider.js +0 -48
- package/lib/AzureFunctionTokenProvider.js.map +0 -1
- package/lib/beta.d.ts +0 -30
- package/src/AzureFunctionTokenProvider.ts +0 -61
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AzureFunctionTokenProvider = void 0;
|
|
11
|
-
const axios_1 = __importDefault(require("axios"));
|
|
12
|
-
/**
|
|
13
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
14
|
-
* Azure Fluid Relay token resolution.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
17
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
18
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
class AzureFunctionTokenProvider {
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new instance using configuration parameters.
|
|
24
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
25
|
-
* @param user - User object
|
|
26
|
-
*/
|
|
27
|
-
constructor(azFunctionUrl, user) {
|
|
28
|
-
this.azFunctionUrl = azFunctionUrl;
|
|
29
|
-
this.user = user;
|
|
30
|
-
}
|
|
31
|
-
async fetchOrdererToken(tenantId, documentId) {
|
|
32
|
-
return {
|
|
33
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async fetchStorageToken(tenantId, documentId) {
|
|
37
|
-
return {
|
|
38
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
async getToken(tenantId, documentId) {
|
|
42
|
-
const response = await axios_1.default.get(this.azFunctionUrl, {
|
|
43
|
-
params: {
|
|
44
|
-
tenantId,
|
|
45
|
-
documentId,
|
|
46
|
-
id: this.user?.id,
|
|
47
|
-
name: this.user?.name,
|
|
48
|
-
additionalDetails: this.user?.additionalDetails,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
return response.data;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.AzureFunctionTokenProvider = AzureFunctionTokenProvider;
|
|
55
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,kDAA0B;AAI1B;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAA6D;QAD7D,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAyD;IAC5E,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAC3D,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACpD,MAAM,EAAE;gBACP,QAAQ;gBACR,UAAU;gBACV,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI;gBACrB,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD;AAzCD,gEAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport axios from \"axios\";\n\nimport type { AzureMember } from \"./interfaces.js\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n *\n * @deprecated 1.2.0, This API will be removed in 2.0.0\n * No replacement since it is not expected anyone will use this token provider as is\n * See https://github.com/microsoft/FluidFramework/issues/13693 for context\n * @internal\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n\t/**\n\t * Creates a new instance using configuration parameters.\n\t * @param azFunctionUrl - URL to Azure Function endpoint\n\t * @param user - User object\n\t */\n\tpublic constructor(\n\t\tprivate readonly azFunctionUrl: string,\n\t\tprivate readonly user?: Pick<AzureMember, \"id\" | \"name\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate async getToken(tenantId: string, documentId?: string): Promise<string> {\n\t\tconst response = await axios.get(this.azFunctionUrl, {\n\t\t\tparams: {\n\t\t\t\ttenantId,\n\t\t\t\tdocumentId,\n\t\t\t\tid: this.user?.id,\n\t\t\t\tname: this.user?.name,\n\t\t\t\tadditionalDetails: this.user?.additionalDetails as unknown,\n\t\t\t},\n\t\t});\n\t\treturn response.data as string;\n\t}\n}\n"]}
|
package/dist/beta.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
// @public APIs
|
|
13
|
-
AzureClient,
|
|
14
|
-
AzureClientProps,
|
|
15
|
-
AzureConnectionConfig,
|
|
16
|
-
AzureConnectionConfigType,
|
|
17
|
-
AzureContainerServices,
|
|
18
|
-
AzureContainerVersion,
|
|
19
|
-
AzureGetVersionsOptions,
|
|
20
|
-
AzureLocalConnectionConfig,
|
|
21
|
-
AzureMember,
|
|
22
|
-
AzureRemoteConnectionConfig,
|
|
23
|
-
CompatibilityMode,
|
|
24
|
-
IAzureAudience,
|
|
25
|
-
ITelemetryBaseEvent,
|
|
26
|
-
ITelemetryBaseLogger,
|
|
27
|
-
ITokenProvider,
|
|
28
|
-
ITokenResponse,
|
|
29
|
-
IUser
|
|
30
|
-
} from "./index.js";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
6
|
-
import type { AzureMember } from "./interfaces.js";
|
|
7
|
-
/**
|
|
8
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
9
|
-
* Azure Fluid Relay token resolution.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
12
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
13
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare class AzureFunctionTokenProvider implements ITokenProvider {
|
|
17
|
-
private readonly azFunctionUrl;
|
|
18
|
-
private readonly user?;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new instance using configuration parameters.
|
|
21
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
22
|
-
* @param user - User object
|
|
23
|
-
*/
|
|
24
|
-
constructor(azFunctionUrl: string, user?: Pick<AzureMember<any>, "name" | "id" | "additionalDetails"> | undefined);
|
|
25
|
-
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
26
|
-
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
27
|
-
private getToken;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAO/D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAPvB;;;;OAIG;gBAEe,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,yEAAwD;IAGlE,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAMb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;YAMZ,QAAQ;CAYtB"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import axios from "axios";
|
|
6
|
-
/**
|
|
7
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
8
|
-
* Azure Fluid Relay token resolution.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
11
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
12
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export class AzureFunctionTokenProvider {
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new instance using configuration parameters.
|
|
18
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
19
|
-
* @param user - User object
|
|
20
|
-
*/
|
|
21
|
-
constructor(azFunctionUrl, user) {
|
|
22
|
-
this.azFunctionUrl = azFunctionUrl;
|
|
23
|
-
this.user = user;
|
|
24
|
-
}
|
|
25
|
-
async fetchOrdererToken(tenantId, documentId) {
|
|
26
|
-
return {
|
|
27
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async fetchStorageToken(tenantId, documentId) {
|
|
31
|
-
return {
|
|
32
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
async getToken(tenantId, documentId) {
|
|
36
|
-
const response = await axios.get(this.azFunctionUrl, {
|
|
37
|
-
params: {
|
|
38
|
-
tenantId,
|
|
39
|
-
documentId,
|
|
40
|
-
id: this.user?.id,
|
|
41
|
-
name: this.user?.name,
|
|
42
|
-
additionalDetails: this.user?.additionalDetails,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
return response.data;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAA6D;QAD7D,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAyD;IAC5E,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAC3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACpD,MAAM,EAAE;gBACP,QAAQ;gBACR,UAAU;gBACV,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI;gBACrB,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport axios from \"axios\";\n\nimport type { AzureMember } from \"./interfaces.js\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n *\n * @deprecated 1.2.0, This API will be removed in 2.0.0\n * No replacement since it is not expected anyone will use this token provider as is\n * See https://github.com/microsoft/FluidFramework/issues/13693 for context\n * @internal\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n\t/**\n\t * Creates a new instance using configuration parameters.\n\t * @param azFunctionUrl - URL to Azure Function endpoint\n\t * @param user - User object\n\t */\n\tpublic constructor(\n\t\tprivate readonly azFunctionUrl: string,\n\t\tprivate readonly user?: Pick<AzureMember, \"id\" | \"name\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate async getToken(tenantId: string, documentId?: string): Promise<string> {\n\t\tconst response = await axios.get(this.azFunctionUrl, {\n\t\t\tparams: {\n\t\t\t\ttenantId,\n\t\t\t\tdocumentId,\n\t\t\t\tid: this.user?.id,\n\t\t\t\tname: this.user?.name,\n\t\t\t\tadditionalDetails: this.user?.additionalDetails as unknown,\n\t\t\t},\n\t\t});\n\t\treturn response.data as string;\n\t}\n}\n"]}
|
package/lib/beta.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
// @public APIs
|
|
13
|
-
AzureClient,
|
|
14
|
-
AzureClientProps,
|
|
15
|
-
AzureConnectionConfig,
|
|
16
|
-
AzureConnectionConfigType,
|
|
17
|
-
AzureContainerServices,
|
|
18
|
-
AzureContainerVersion,
|
|
19
|
-
AzureGetVersionsOptions,
|
|
20
|
-
AzureLocalConnectionConfig,
|
|
21
|
-
AzureMember,
|
|
22
|
-
AzureRemoteConnectionConfig,
|
|
23
|
-
CompatibilityMode,
|
|
24
|
-
IAzureAudience,
|
|
25
|
-
ITelemetryBaseEvent,
|
|
26
|
-
ITelemetryBaseLogger,
|
|
27
|
-
ITokenProvider,
|
|
28
|
-
ITokenResponse,
|
|
29
|
-
IUser
|
|
30
|
-
} from "./index.js";
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
7
|
-
import axios from "axios";
|
|
8
|
-
|
|
9
|
-
import type { AzureMember } from "./interfaces.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
13
|
-
* Azure Fluid Relay token resolution.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
16
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
17
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export class AzureFunctionTokenProvider implements ITokenProvider {
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new instance using configuration parameters.
|
|
23
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
24
|
-
* @param user - User object
|
|
25
|
-
*/
|
|
26
|
-
public constructor(
|
|
27
|
-
private readonly azFunctionUrl: string,
|
|
28
|
-
private readonly user?: Pick<AzureMember, "id" | "name" | "additionalDetails">,
|
|
29
|
-
) {}
|
|
30
|
-
|
|
31
|
-
public async fetchOrdererToken(
|
|
32
|
-
tenantId: string,
|
|
33
|
-
documentId?: string,
|
|
34
|
-
): Promise<ITokenResponse> {
|
|
35
|
-
return {
|
|
36
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public async fetchStorageToken(
|
|
41
|
-
tenantId: string,
|
|
42
|
-
documentId: string,
|
|
43
|
-
): Promise<ITokenResponse> {
|
|
44
|
-
return {
|
|
45
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private async getToken(tenantId: string, documentId?: string): Promise<string> {
|
|
50
|
-
const response = await axios.get(this.azFunctionUrl, {
|
|
51
|
-
params: {
|
|
52
|
-
tenantId,
|
|
53
|
-
documentId,
|
|
54
|
-
id: this.user?.id,
|
|
55
|
-
name: this.user?.name,
|
|
56
|
-
additionalDetails: this.user?.additionalDetails as unknown,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
return response.data as string;
|
|
60
|
-
}
|
|
61
|
-
}
|