firebase-admin 9.100.0-alpha.0 → 10.0.2
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 +7 -3
- package/lib/app/core.d.ts +15 -22
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +17 -33
- package/lib/app/credential-factory.js +17 -33
- package/lib/app/credential-internal.d.ts +10 -9
- package/lib/app/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +3 -9
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +6 -30
- package/lib/app/firebase-app.js +72 -216
- package/lib/app/firebase-namespace.d.ts +28 -34
- package/lib/app/firebase-namespace.js +119 -99
- package/lib/app/index.d.ts +6 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +24 -3
- package/lib/app/lifecycle.js +119 -25
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +197 -0
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +82 -0
- package/lib/app-check/index.d.ts +53 -0
- package/lib/app-check/index.js +63 -0
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +159 -0
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +151 -0
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +2 -2
- package/lib/auth/auth-api-request.d.ts +28 -32
- package/lib/auth/auth-api-request.js +167 -125
- package/lib/auth/auth-config.d.ts +123 -21
- package/lib/auth/auth-config.js +85 -34
- package/lib/auth/auth-namespace.d.ts +157 -4
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +5 -3
- package/lib/auth/auth.js +6 -4
- package/lib/auth/base-auth.d.ts +134 -116
- package/lib/auth/base-auth.js +213 -143
- package/lib/auth/identifier.d.ts +5 -5
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +10 -5
- package/lib/auth/index.js +9 -4
- package/lib/auth/tenant-manager.d.ts +19 -19
- package/lib/auth/tenant-manager.js +21 -25
- package/lib/auth/tenant.d.ts +14 -5
- package/lib/auth/tenant.js +19 -11
- package/lib/auth/token-generator.d.ts +7 -108
- package/lib/auth/token-generator.js +52 -145
- package/lib/auth/token-verifier.d.ts +3 -4
- package/lib/auth/token-verifier.js +96 -145
- package/lib/auth/user-import-builder.d.ts +11 -11
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +23 -15
- package/lib/auth/user-record.js +30 -20
- package/lib/credential/index.d.ts +18 -35
- package/lib/credential/index.js +17 -33
- package/lib/database/database-namespace.d.ts +39 -10
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +16 -6
- package/lib/database/database.js +61 -6
- package/lib/database/index.d.ts +19 -18
- package/lib/database/index.js +21 -23
- package/lib/default-namespace.d.ts +7 -1
- package/lib/default-namespace.js +4 -4
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +24 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +12 -6
- package/lib/firebase-namespace-api.js +5 -1
- package/lib/firestore/firestore-internal.d.ts +2 -2
- package/lib/firestore/firestore-internal.js +2 -2
- package/lib/firestore/firestore-namespace.d.ts +6 -1
- package/lib/firestore/firestore-namespace.js +2 -1
- package/lib/firestore/index.d.ts +36 -4
- package/lib/firestore/index.js +29 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +52 -0
- package/lib/installations/index.js +62 -0
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
- package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +63 -0
- package/lib/instance-id/index.d.ts +20 -9
- package/lib/instance-id/index.js +20 -9
- package/lib/instance-id/instance-id-namespace.d.ts +9 -8
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +8 -6
- package/lib/instance-id/instance-id.js +20 -11
- package/lib/machine-learning/index.d.ts +29 -27
- package/lib/machine-learning/index.js +29 -27
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +4 -4
- package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +19 -19
- package/lib/machine-learning/machine-learning.js +20 -20
- package/lib/messaging/batch-request-internal.d.ts +3 -3
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +11 -9
- package/lib/messaging/index.js +11 -9
- package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +79 -75
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +5 -5
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +6 -31
- package/lib/messaging/messaging-namespace.d.ts +105 -8
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +70 -86
- package/lib/messaging/messaging.js +76 -89
- package/lib/project-management/android-app.d.ts +11 -12
- package/lib/project-management/android-app.js +13 -14
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/index.d.ts +11 -9
- package/lib/project-management/index.js +11 -9
- package/lib/project-management/ios-app.d.ts +6 -7
- package/lib/project-management/ios-app.js +6 -7
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
- package/lib/project-management/project-management-api-request-internal.js +14 -14
- package/lib/project-management/project-management-namespace.d.ts +31 -9
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +18 -21
- package/lib/project-management/project-management.js +19 -22
- package/lib/remote-config/index.d.ts +12 -10
- package/lib/remote-config/index.js +11 -9
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +2 -2
- package/lib/remote-config/remote-config-api.d.ts +12 -2
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +50 -9
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +19 -21
- package/lib/remote-config/remote-config.js +25 -25
- package/lib/security-rules/index.d.ts +12 -10
- package/lib/security-rules/index.js +12 -10
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +43 -28
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +39 -42
- package/lib/security-rules/security-rules.js +38 -39
- package/lib/storage/index.d.ts +9 -7
- package/lib/storage/index.js +9 -7
- package/lib/storage/storage-namespace.d.ts +7 -6
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +3 -3
- package/lib/storage/storage.js +14 -4
- package/lib/utils/api-request.d.ts +24 -24
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +237 -0
- package/lib/utils/deep-copy.d.ts +6 -6
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +69 -36
- package/lib/utils/error.js +98 -43
- package/lib/utils/index.d.ts +30 -19
- package/lib/utils/index.js +47 -20
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +355 -0
- package/lib/utils/validator.d.ts +37 -37
- package/lib/utils/validator.js +37 -37
- package/package.json +126 -53
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -96,8 +96,8 @@ var AuthResourceUrlBuilder = /** @class */ (function () {
|
|
|
96
96
|
/**
|
|
97
97
|
* The resource URL builder constructor.
|
|
98
98
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @param
|
|
99
|
+
* @param projectId - The resource project ID.
|
|
100
|
+
* @param version - The endpoint API version.
|
|
101
101
|
* @constructor
|
|
102
102
|
*/
|
|
103
103
|
function AuthResourceUrlBuilder(app, version) {
|
|
@@ -116,10 +116,10 @@ var AuthResourceUrlBuilder = /** @class */ (function () {
|
|
|
116
116
|
/**
|
|
117
117
|
* Returns the resource URL corresponding to the provided parameters.
|
|
118
118
|
*
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
119
|
+
* @param api - The backend API name.
|
|
120
|
+
* @param params - The optional additional parameters to substitute in the
|
|
121
121
|
* URL path.
|
|
122
|
-
* @
|
|
122
|
+
* @returns The corresponding resource URL.
|
|
123
123
|
*/
|
|
124
124
|
AuthResourceUrlBuilder.prototype.getUrl = function (api, params) {
|
|
125
125
|
var _this = this;
|
|
@@ -159,9 +159,9 @@ var TenantAwareAuthResourceUrlBuilder = /** @class */ (function (_super) {
|
|
|
159
159
|
/**
|
|
160
160
|
* The tenant aware resource URL builder constructor.
|
|
161
161
|
*
|
|
162
|
-
* @param
|
|
163
|
-
* @param
|
|
164
|
-
* @param
|
|
162
|
+
* @param projectId - The resource project ID.
|
|
163
|
+
* @param version - The endpoint API version.
|
|
164
|
+
* @param tenantId - The tenant ID.
|
|
165
165
|
* @constructor
|
|
166
166
|
*/
|
|
167
167
|
function TenantAwareAuthResourceUrlBuilder(app, version, tenantId) {
|
|
@@ -182,10 +182,10 @@ var TenantAwareAuthResourceUrlBuilder = /** @class */ (function (_super) {
|
|
|
182
182
|
/**
|
|
183
183
|
* Returns the resource URL corresponding to the provided parameters.
|
|
184
184
|
*
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
185
|
+
* @param api - The backend API name.
|
|
186
|
+
* @param params - The optional additional parameters to substitute in the
|
|
187
187
|
* URL path.
|
|
188
|
-
* @
|
|
188
|
+
* @returns The corresponding resource URL.
|
|
189
189
|
*/
|
|
190
190
|
TenantAwareAuthResourceUrlBuilder.prototype.getUrl = function (api, params) {
|
|
191
191
|
var _this = this;
|
|
@@ -218,10 +218,9 @@ var AuthHttpClient = /** @class */ (function (_super) {
|
|
|
218
218
|
* are removed from the original request. If an invalid field is passed
|
|
219
219
|
* an error is thrown.
|
|
220
220
|
*
|
|
221
|
-
* @param request The AuthFactorInfo request object.
|
|
222
|
-
* @param writeOperationType The write operation type.
|
|
221
|
+
* @param request - The AuthFactorInfo request object.
|
|
223
222
|
*/
|
|
224
|
-
function validateAuthFactorInfo(request
|
|
223
|
+
function validateAuthFactorInfo(request) {
|
|
225
224
|
var validKeys = {
|
|
226
225
|
mfaEnrollmentId: true,
|
|
227
226
|
displayName: true,
|
|
@@ -236,8 +235,8 @@ function validateAuthFactorInfo(request, writeOperationType) {
|
|
|
236
235
|
}
|
|
237
236
|
// No enrollment ID is available for signupNewUser. Use another identifier.
|
|
238
237
|
var authFactorInfoIdentifier = request.mfaEnrollmentId || request.phoneInfo || JSON.stringify(request);
|
|
239
|
-
|
|
240
|
-
if (
|
|
238
|
+
// Enrollment uid may or may not be specified for update operations.
|
|
239
|
+
if (typeof request.mfaEnrollmentId !== 'undefined' &&
|
|
241
240
|
!validator.isNonEmptyString(request.mfaEnrollmentId)) {
|
|
242
241
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_UID, 'The second factor "uid" must be a valid non-empty string.');
|
|
243
242
|
}
|
|
@@ -270,7 +269,7 @@ function validateAuthFactorInfo(request, writeOperationType) {
|
|
|
270
269
|
* are removed from the original request. If an invalid field is passed
|
|
271
270
|
* an error is thrown.
|
|
272
271
|
*
|
|
273
|
-
* @param
|
|
272
|
+
* @param request - The providerUserInfo request object.
|
|
274
273
|
*/
|
|
275
274
|
function validateProviderUserInfo(request) {
|
|
276
275
|
var validKeys = {
|
|
@@ -315,8 +314,8 @@ function validateProviderUserInfo(request) {
|
|
|
315
314
|
* are removed from the original request. If an invalid field is passed
|
|
316
315
|
* an error is thrown.
|
|
317
316
|
*
|
|
318
|
-
* @param request The create/edit request object.
|
|
319
|
-
* @param writeOperationType The write operation type.
|
|
317
|
+
* @param request - The create/edit request object.
|
|
318
|
+
* @param writeOperationType - The write operation type.
|
|
320
319
|
*/
|
|
321
320
|
function validateCreateEditRequest(request, writeOperationType) {
|
|
322
321
|
var uploadAccountRequest = writeOperationType === WriteOperationType.Upload;
|
|
@@ -337,6 +336,8 @@ function validateCreateEditRequest(request, writeOperationType) {
|
|
|
337
336
|
phoneNumber: true,
|
|
338
337
|
customAttributes: true,
|
|
339
338
|
validSince: true,
|
|
339
|
+
// Pass linkProviderUserInfo only for updates (i.e. not for uploads.)
|
|
340
|
+
linkProviderUserInfo: !uploadAccountRequest,
|
|
340
341
|
// Pass tenantId only for uploadAccount requests.
|
|
341
342
|
tenantId: uploadAccountRequest,
|
|
342
343
|
passwordHash: uploadAccountRequest,
|
|
@@ -481,6 +482,10 @@ function validateCreateEditRequest(request, writeOperationType) {
|
|
|
481
482
|
validateProviderUserInfo(providerUserInfoEntry);
|
|
482
483
|
});
|
|
483
484
|
}
|
|
485
|
+
// linkProviderUserInfo must be a (single) UserProvider value.
|
|
486
|
+
if (typeof request.linkProviderUserInfo !== 'undefined') {
|
|
487
|
+
validateProviderUserInfo(request.linkProviderUserInfo);
|
|
488
|
+
}
|
|
484
489
|
// mfaInfo is used for importUsers.
|
|
485
490
|
// mfa.enrollments is used for setAccountInfo.
|
|
486
491
|
// enrollments has to be an array of valid AuthFactorInfo requests.
|
|
@@ -496,7 +501,7 @@ function validateCreateEditRequest(request, writeOperationType) {
|
|
|
496
501
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ENROLLED_FACTORS);
|
|
497
502
|
}
|
|
498
503
|
enrollments.forEach(function (authFactorInfoEntry) {
|
|
499
|
-
validateAuthFactorInfo(authFactorInfoEntry
|
|
504
|
+
validateAuthFactorInfo(authFactorInfoEntry);
|
|
500
505
|
});
|
|
501
506
|
}
|
|
502
507
|
}
|
|
@@ -831,7 +836,7 @@ var LIST_INBOUND_SAML_CONFIGS = new api_request_1.ApiSettings('/inboundSamlConfi
|
|
|
831
836
|
*/
|
|
832
837
|
var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
833
838
|
/**
|
|
834
|
-
* @param
|
|
839
|
+
* @param app - The app used to fetch access tokens to sign API requests.
|
|
835
840
|
* @constructor
|
|
836
841
|
*/
|
|
837
842
|
function AbstractAuthRequestHandler(app) {
|
|
@@ -842,8 +847,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
842
847
|
this.httpClient = new AuthHttpClient(app);
|
|
843
848
|
}
|
|
844
849
|
/**
|
|
845
|
-
* @param
|
|
846
|
-
* @
|
|
850
|
+
* @param response - The response to check for errors.
|
|
851
|
+
* @returns The error code if present; null otherwise.
|
|
847
852
|
*/
|
|
848
853
|
AbstractAuthRequestHandler.getErrorCode = function (response) {
|
|
849
854
|
return (validator.isNonNullObject(response) && response.error && response.error.message) || null;
|
|
@@ -890,10 +895,10 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
890
895
|
* session management (set as a server side session cookie with custom cookie policy).
|
|
891
896
|
* The session cookie JWT will have the same payload claims as the provided ID token.
|
|
892
897
|
*
|
|
893
|
-
* @param
|
|
894
|
-
* @param
|
|
898
|
+
* @param idToken - The Firebase ID token to exchange for a session cookie.
|
|
899
|
+
* @param expiresIn - The session cookie duration in milliseconds.
|
|
895
900
|
*
|
|
896
|
-
* @
|
|
901
|
+
* @returns A promise that resolves on success with the created session cookie.
|
|
897
902
|
*/
|
|
898
903
|
AbstractAuthRequestHandler.prototype.createSessionCookie = function (idToken, expiresIn) {
|
|
899
904
|
var request = {
|
|
@@ -907,8 +912,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
907
912
|
/**
|
|
908
913
|
* Looks up a user by uid.
|
|
909
914
|
*
|
|
910
|
-
* @param
|
|
911
|
-
* @
|
|
915
|
+
* @param uid - The uid of the user to lookup.
|
|
916
|
+
* @returns A promise that resolves with the user information.
|
|
912
917
|
*/
|
|
913
918
|
AbstractAuthRequestHandler.prototype.getAccountInfoByUid = function (uid) {
|
|
914
919
|
if (!validator.isUid(uid)) {
|
|
@@ -922,8 +927,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
922
927
|
/**
|
|
923
928
|
* Looks up a user by email.
|
|
924
929
|
*
|
|
925
|
-
* @param
|
|
926
|
-
* @
|
|
930
|
+
* @param email - The email of the user to lookup.
|
|
931
|
+
* @returns A promise that resolves with the user information.
|
|
927
932
|
*/
|
|
928
933
|
AbstractAuthRequestHandler.prototype.getAccountInfoByEmail = function (email) {
|
|
929
934
|
if (!validator.isEmail(email)) {
|
|
@@ -937,8 +942,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
937
942
|
/**
|
|
938
943
|
* Looks up a user by phone number.
|
|
939
944
|
*
|
|
940
|
-
* @param
|
|
941
|
-
* @
|
|
945
|
+
* @param phoneNumber - The phone number of the user to lookup.
|
|
946
|
+
* @returns A promise that resolves with the user information.
|
|
942
947
|
*/
|
|
943
948
|
AbstractAuthRequestHandler.prototype.getAccountInfoByPhoneNumber = function (phoneNumber) {
|
|
944
949
|
if (!validator.isPhoneNumber(phoneNumber)) {
|
|
@@ -949,12 +954,24 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
949
954
|
};
|
|
950
955
|
return this.invokeRequestHandler(this.getAuthUrlBuilder(), exports.FIREBASE_AUTH_GET_ACCOUNT_INFO, request);
|
|
951
956
|
};
|
|
957
|
+
AbstractAuthRequestHandler.prototype.getAccountInfoByFederatedUid = function (providerId, rawId) {
|
|
958
|
+
if (!validator.isNonEmptyString(providerId) || !validator.isNonEmptyString(rawId)) {
|
|
959
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_PROVIDER_ID);
|
|
960
|
+
}
|
|
961
|
+
var request = {
|
|
962
|
+
federatedUserId: [{
|
|
963
|
+
providerId: providerId,
|
|
964
|
+
rawId: rawId,
|
|
965
|
+
}],
|
|
966
|
+
};
|
|
967
|
+
return this.invokeRequestHandler(this.getAuthUrlBuilder(), exports.FIREBASE_AUTH_GET_ACCOUNT_INFO, request);
|
|
968
|
+
};
|
|
952
969
|
/**
|
|
953
970
|
* Looks up multiple users by their identifiers (uid, email, etc).
|
|
954
971
|
*
|
|
955
|
-
* @param
|
|
972
|
+
* @param identifiers - The identifiers indicating the users
|
|
956
973
|
* to be looked up. Must have <= 100 entries.
|
|
957
|
-
* @param
|
|
974
|
+
* @param A - promise that resolves with the set of successfully
|
|
958
975
|
* looked up users. Possibly empty if no users were looked up.
|
|
959
976
|
*/
|
|
960
977
|
AbstractAuthRequestHandler.prototype.getAccountInfoByIdentifiers = function (identifiers) {
|
|
@@ -989,12 +1006,12 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
989
1006
|
* Exports the users (single batch only) with a size of maxResults and starting from
|
|
990
1007
|
* the offset as specified by pageToken.
|
|
991
1008
|
*
|
|
992
|
-
* @param
|
|
1009
|
+
* @param maxResults - The page size, 1000 if undefined. This is also the maximum
|
|
993
1010
|
* allowed limit.
|
|
994
|
-
* @param
|
|
1011
|
+
* @param pageToken - The next page token. If not specified, returns users starting
|
|
995
1012
|
* without any offset. Users are returned in the order they were created from oldest to
|
|
996
1013
|
* newest, relative to the page token offset.
|
|
997
|
-
* @
|
|
1014
|
+
* @returns A promise that resolves with the current batch of downloaded
|
|
998
1015
|
* users and the next page token if available. For the last page, an empty list of users
|
|
999
1016
|
* and no page token are returned.
|
|
1000
1017
|
*/
|
|
@@ -1024,10 +1041,10 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1024
1041
|
* At most, 1000 users are allowed to be imported one at a time.
|
|
1025
1042
|
* When importing a list of password users, UserImportOptions are required to be specified.
|
|
1026
1043
|
*
|
|
1027
|
-
* @param
|
|
1028
|
-
* @param
|
|
1044
|
+
* @param users - The list of user records to import to Firebase Auth.
|
|
1045
|
+
* @param options - The user import options, required when the users provided
|
|
1029
1046
|
* include password credentials.
|
|
1030
|
-
* @
|
|
1047
|
+
* @returns A promise that resolves when the operation completes
|
|
1031
1048
|
* with the result of the import. This includes the number of successful imports, the number
|
|
1032
1049
|
* of failed uploads and their corresponding errors.
|
|
1033
1050
|
*/
|
|
@@ -1061,8 +1078,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1061
1078
|
/**
|
|
1062
1079
|
* Deletes an account identified by a uid.
|
|
1063
1080
|
*
|
|
1064
|
-
* @param
|
|
1065
|
-
* @
|
|
1081
|
+
* @param uid - The uid of the user to delete.
|
|
1082
|
+
* @returns A promise that resolves when the user is deleted.
|
|
1066
1083
|
*/
|
|
1067
1084
|
AbstractAuthRequestHandler.prototype.deleteAccount = function (uid) {
|
|
1068
1085
|
if (!validator.isUid(uid)) {
|
|
@@ -1095,9 +1112,9 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1095
1112
|
/**
|
|
1096
1113
|
* Sets additional developer claims on an existing user identified by provided UID.
|
|
1097
1114
|
*
|
|
1098
|
-
* @param
|
|
1099
|
-
* @param
|
|
1100
|
-
* @
|
|
1115
|
+
* @param uid - The user to edit.
|
|
1116
|
+
* @param customUserClaims - The developer claims to set.
|
|
1117
|
+
* @returns A promise that resolves when the operation completes
|
|
1101
1118
|
* with the user id that was edited.
|
|
1102
1119
|
*/
|
|
1103
1120
|
AbstractAuthRequestHandler.prototype.setCustomUserClaims = function (uid, customUserClaims) {
|
|
@@ -1125,9 +1142,9 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1125
1142
|
/**
|
|
1126
1143
|
* Edits an existing user.
|
|
1127
1144
|
*
|
|
1128
|
-
* @param
|
|
1129
|
-
* @param
|
|
1130
|
-
* @
|
|
1145
|
+
* @param uid - The user to edit.
|
|
1146
|
+
* @param properties - The properties to set on the user.
|
|
1147
|
+
* @returns A promise that resolves when the operation completes
|
|
1131
1148
|
* with the user id that was edited.
|
|
1132
1149
|
*/
|
|
1133
1150
|
AbstractAuthRequestHandler.prototype.updateExistingAccount = function (uid, properties) {
|
|
@@ -1137,6 +1154,26 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1137
1154
|
else if (!validator.isNonNullObject(properties)) {
|
|
1138
1155
|
return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'Properties argument must be a non-null object.'));
|
|
1139
1156
|
}
|
|
1157
|
+
else if (validator.isNonNullObject(properties.providerToLink)) {
|
|
1158
|
+
// TODO(rsgowman): These checks overlap somewhat with
|
|
1159
|
+
// validateProviderUserInfo. It may be possible to refactor a bit.
|
|
1160
|
+
if (!validator.isNonEmptyString(properties.providerToLink.providerId)) {
|
|
1161
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'providerToLink.providerId of properties argument must be a non-empty string.');
|
|
1162
|
+
}
|
|
1163
|
+
if (!validator.isNonEmptyString(properties.providerToLink.uid)) {
|
|
1164
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'providerToLink.uid of properties argument must be a non-empty string.');
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
else if (typeof properties.providersToUnlink !== 'undefined') {
|
|
1168
|
+
if (!validator.isArray(properties.providersToUnlink)) {
|
|
1169
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'providersToUnlink of properties argument must be an array of strings.');
|
|
1170
|
+
}
|
|
1171
|
+
properties.providersToUnlink.forEach(function (providerId) {
|
|
1172
|
+
if (!validator.isNonEmptyString(providerId)) {
|
|
1173
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'providersToUnlink of properties argument must be an array of strings.');
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1140
1177
|
// Build the setAccountInfo request.
|
|
1141
1178
|
var request = deep_copy_1.deepCopy(properties);
|
|
1142
1179
|
request.localId = uid;
|
|
@@ -1167,14 +1204,22 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1167
1204
|
// It will be removed from the backend request and an additional parameter
|
|
1168
1205
|
// deleteProvider: ['phone'] with an array of providerIds (phone in this case),
|
|
1169
1206
|
// will be passed.
|
|
1170
|
-
// Currently this applies to phone provider only.
|
|
1171
1207
|
if (request.phoneNumber === null) {
|
|
1172
|
-
request.deleteProvider = ['phone'];
|
|
1208
|
+
request.deleteProvider ? request.deleteProvider.push('phone') : request.deleteProvider = ['phone'];
|
|
1173
1209
|
delete request.phoneNumber;
|
|
1174
1210
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
delete request.
|
|
1211
|
+
if (typeof (request.providerToLink) !== 'undefined') {
|
|
1212
|
+
request.linkProviderUserInfo = deep_copy_1.deepCopy(request.providerToLink);
|
|
1213
|
+
delete request.providerToLink;
|
|
1214
|
+
request.linkProviderUserInfo.rawId = request.linkProviderUserInfo.uid;
|
|
1215
|
+
delete request.linkProviderUserInfo.uid;
|
|
1216
|
+
}
|
|
1217
|
+
if (typeof (request.providersToUnlink) !== 'undefined') {
|
|
1218
|
+
if (!validator.isArray(request.deleteProvider)) {
|
|
1219
|
+
request.deleteProvider = [];
|
|
1220
|
+
}
|
|
1221
|
+
request.deleteProvider = request.deleteProvider.concat(request.providersToUnlink);
|
|
1222
|
+
delete request.providersToUnlink;
|
|
1178
1223
|
}
|
|
1179
1224
|
// Rewrite photoURL to photoUrl.
|
|
1180
1225
|
if (typeof request.photoURL !== 'undefined') {
|
|
@@ -1224,8 +1269,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1224
1269
|
* the same second as the revocation will still be valid. If there is a chance that a token
|
|
1225
1270
|
* was minted in the last second, delay for 1 second before revoking.
|
|
1226
1271
|
*
|
|
1227
|
-
* @param
|
|
1228
|
-
* @
|
|
1272
|
+
* @param uid - The user whose tokens are to be revoked.
|
|
1273
|
+
* @returns A promise that resolves when the operation completes
|
|
1229
1274
|
* successfully with the user id of the corresponding user.
|
|
1230
1275
|
*/
|
|
1231
1276
|
AbstractAuthRequestHandler.prototype.revokeRefreshTokens = function (uid) {
|
|
@@ -1246,15 +1291,14 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1246
1291
|
/**
|
|
1247
1292
|
* Create a new user with the properties supplied.
|
|
1248
1293
|
*
|
|
1249
|
-
* @param
|
|
1250
|
-
* @
|
|
1294
|
+
* @param properties - The properties to set on the user.
|
|
1295
|
+
* @returns A promise that resolves when the operation completes
|
|
1251
1296
|
* with the user id that was created.
|
|
1252
1297
|
*/
|
|
1253
1298
|
AbstractAuthRequestHandler.prototype.createNewAccount = function (properties) {
|
|
1254
1299
|
if (!validator.isNonNullObject(properties)) {
|
|
1255
1300
|
return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, 'Properties argument must be a non-null object.'));
|
|
1256
1301
|
}
|
|
1257
|
-
// Build the signupNewUser request.
|
|
1258
1302
|
var request = deep_copy_1.deepCopy(properties);
|
|
1259
1303
|
// Rewrite photoURL to photoUrl.
|
|
1260
1304
|
if (typeof request.photoURL !== 'undefined') {
|
|
@@ -1274,10 +1318,10 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1274
1318
|
request.multiFactor.enrolledFactors.forEach(function (multiFactorInfo) {
|
|
1275
1319
|
// Enrollment time and uid are not allowed for signupNewUser endpoint.
|
|
1276
1320
|
// They will automatically be provisioned server side.
|
|
1277
|
-
if (multiFactorInfo
|
|
1321
|
+
if ('enrollmentTime' in multiFactorInfo) {
|
|
1278
1322
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"enrollmentTime" is not supported when adding second factors via "createUser()"');
|
|
1279
1323
|
}
|
|
1280
|
-
else if (multiFactorInfo
|
|
1324
|
+
else if ('uid' in multiFactorInfo) {
|
|
1281
1325
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"uid" is not supported when adding second factors via "createUser()"');
|
|
1282
1326
|
}
|
|
1283
1327
|
mfaInfo_1.push(user_import_builder_1.convertMultiFactorInfoToServerFormat(multiFactorInfo));
|
|
@@ -1300,13 +1344,13 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1300
1344
|
* Generates the out of band email action link for the email specified using the action code settings provided.
|
|
1301
1345
|
* Returns a promise that resolves with the generated link.
|
|
1302
1346
|
*
|
|
1303
|
-
* @param
|
|
1347
|
+
* @param requestType - The request type. This could be either used for password reset,
|
|
1304
1348
|
* email verification, email link sign-in.
|
|
1305
|
-
* @param
|
|
1306
|
-
* @param
|
|
1349
|
+
* @param email - The email of the user the link is being sent to.
|
|
1350
|
+
* @param actionCodeSettings - The optional action code setings which defines whether
|
|
1307
1351
|
* the link is to be handled by a mobile app and the additional state information to be passed in the
|
|
1308
1352
|
* deep link, etc. Required when requestType == 'EMAIL_SIGNIN'
|
|
1309
|
-
* @
|
|
1353
|
+
* @returns A promise that resolves with the email action link.
|
|
1310
1354
|
*/
|
|
1311
1355
|
AbstractAuthRequestHandler.prototype.getEmailActionLink = function (requestType, email, actionCodeSettings) {
|
|
1312
1356
|
var request = { requestType: requestType, email: email, returnOobLink: true };
|
|
@@ -1333,8 +1377,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1333
1377
|
/**
|
|
1334
1378
|
* Looks up an OIDC provider configuration by provider ID.
|
|
1335
1379
|
*
|
|
1336
|
-
* @param
|
|
1337
|
-
* @
|
|
1380
|
+
* @param providerId - The provider identifier of the configuration to lookup.
|
|
1381
|
+
* @returns A promise that resolves with the provider configuration information.
|
|
1338
1382
|
*/
|
|
1339
1383
|
AbstractAuthRequestHandler.prototype.getOAuthIdpConfig = function (providerId) {
|
|
1340
1384
|
if (!auth_config_1.OIDCConfig.isProviderId(providerId)) {
|
|
@@ -1346,12 +1390,12 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1346
1390
|
* Lists the OIDC configurations (single batch only) with a size of maxResults and starting from
|
|
1347
1391
|
* the offset as specified by pageToken.
|
|
1348
1392
|
*
|
|
1349
|
-
* @param
|
|
1393
|
+
* @param maxResults - The page size, 100 if undefined. This is also the maximum
|
|
1350
1394
|
* allowed limit.
|
|
1351
|
-
* @param
|
|
1395
|
+
* @param pageToken - The next page token. If not specified, returns OIDC configurations
|
|
1352
1396
|
* without any offset. Configurations are returned in the order they were created from oldest to
|
|
1353
1397
|
* newest, relative to the page token offset.
|
|
1354
|
-
* @
|
|
1398
|
+
* @returns A promise that resolves with the current batch of downloaded
|
|
1355
1399
|
* OIDC configurations and the next page token if available. For the last page, an empty list of provider
|
|
1356
1400
|
* configuration and no page token are returned.
|
|
1357
1401
|
*/
|
|
@@ -1376,8 +1420,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1376
1420
|
/**
|
|
1377
1421
|
* Deletes an OIDC configuration identified by a providerId.
|
|
1378
1422
|
*
|
|
1379
|
-
* @param
|
|
1380
|
-
* @
|
|
1423
|
+
* @param providerId - The identifier of the OIDC configuration to delete.
|
|
1424
|
+
* @returns A promise that resolves when the OIDC provider is deleted.
|
|
1381
1425
|
*/
|
|
1382
1426
|
AbstractAuthRequestHandler.prototype.deleteOAuthIdpConfig = function (providerId) {
|
|
1383
1427
|
if (!auth_config_1.OIDCConfig.isProviderId(providerId)) {
|
|
@@ -1391,8 +1435,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1391
1435
|
/**
|
|
1392
1436
|
* Creates a new OIDC provider configuration with the properties provided.
|
|
1393
1437
|
*
|
|
1394
|
-
* @param
|
|
1395
|
-
* @
|
|
1438
|
+
* @param options - The properties to set on the new OIDC provider configuration to be created.
|
|
1439
|
+
* @returns A promise that resolves with the newly created OIDC
|
|
1396
1440
|
* configuration.
|
|
1397
1441
|
*/
|
|
1398
1442
|
AbstractAuthRequestHandler.prototype.createOAuthIdpConfig = function (options) {
|
|
@@ -1416,9 +1460,9 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1416
1460
|
/**
|
|
1417
1461
|
* Updates an existing OIDC provider configuration with the properties provided.
|
|
1418
1462
|
*
|
|
1419
|
-
* @param
|
|
1420
|
-
* @param
|
|
1421
|
-
* @
|
|
1463
|
+
* @param providerId - The provider identifier of the OIDC configuration to update.
|
|
1464
|
+
* @param options - The properties to update on the existing configuration.
|
|
1465
|
+
* @returns A promise that resolves with the modified provider
|
|
1422
1466
|
* configuration.
|
|
1423
1467
|
*/
|
|
1424
1468
|
AbstractAuthRequestHandler.prototype.updateOAuthIdpConfig = function (providerId, options) {
|
|
@@ -1445,8 +1489,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1445
1489
|
/**
|
|
1446
1490
|
* Looks up an SAML provider configuration by provider ID.
|
|
1447
1491
|
*
|
|
1448
|
-
* @param
|
|
1449
|
-
* @
|
|
1492
|
+
* @param providerId - The provider identifier of the configuration to lookup.
|
|
1493
|
+
* @returns A promise that resolves with the provider configuration information.
|
|
1450
1494
|
*/
|
|
1451
1495
|
AbstractAuthRequestHandler.prototype.getInboundSamlConfig = function (providerId) {
|
|
1452
1496
|
if (!auth_config_1.SAMLConfig.isProviderId(providerId)) {
|
|
@@ -1458,12 +1502,12 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1458
1502
|
* Lists the SAML configurations (single batch only) with a size of maxResults and starting from
|
|
1459
1503
|
* the offset as specified by pageToken.
|
|
1460
1504
|
*
|
|
1461
|
-
* @param
|
|
1505
|
+
* @param maxResults - The page size, 100 if undefined. This is also the maximum
|
|
1462
1506
|
* allowed limit.
|
|
1463
|
-
* @param
|
|
1507
|
+
* @param pageToken - The next page token. If not specified, returns SAML configurations starting
|
|
1464
1508
|
* without any offset. Configurations are returned in the order they were created from oldest to
|
|
1465
1509
|
* newest, relative to the page token offset.
|
|
1466
|
-
* @
|
|
1510
|
+
* @returns A promise that resolves with the current batch of downloaded
|
|
1467
1511
|
* SAML configurations and the next page token if available. For the last page, an empty list of provider
|
|
1468
1512
|
* configuration and no page token are returned.
|
|
1469
1513
|
*/
|
|
@@ -1488,8 +1532,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1488
1532
|
/**
|
|
1489
1533
|
* Deletes a SAML configuration identified by a providerId.
|
|
1490
1534
|
*
|
|
1491
|
-
* @param
|
|
1492
|
-
* @
|
|
1535
|
+
* @param providerId - The identifier of the SAML configuration to delete.
|
|
1536
|
+
* @returns A promise that resolves when the SAML provider is deleted.
|
|
1493
1537
|
*/
|
|
1494
1538
|
AbstractAuthRequestHandler.prototype.deleteInboundSamlConfig = function (providerId) {
|
|
1495
1539
|
if (!auth_config_1.SAMLConfig.isProviderId(providerId)) {
|
|
@@ -1503,8 +1547,8 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1503
1547
|
/**
|
|
1504
1548
|
* Creates a new SAML provider configuration with the properties provided.
|
|
1505
1549
|
*
|
|
1506
|
-
* @param
|
|
1507
|
-
* @
|
|
1550
|
+
* @param options - The properties to set on the new SAML provider configuration to be created.
|
|
1551
|
+
* @returns A promise that resolves with the newly created SAML
|
|
1508
1552
|
* configuration.
|
|
1509
1553
|
*/
|
|
1510
1554
|
AbstractAuthRequestHandler.prototype.createInboundSamlConfig = function (options) {
|
|
@@ -1528,9 +1572,9 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1528
1572
|
/**
|
|
1529
1573
|
* Updates an existing SAML provider configuration with the properties provided.
|
|
1530
1574
|
*
|
|
1531
|
-
* @param
|
|
1532
|
-
* @param
|
|
1533
|
-
* @
|
|
1575
|
+
* @param providerId - The provider identifier of the SAML configuration to update.
|
|
1576
|
+
* @param options - The properties to update on the existing configuration.
|
|
1577
|
+
* @returns A promise that resolves with the modified provider
|
|
1534
1578
|
* configuration.
|
|
1535
1579
|
*/
|
|
1536
1580
|
AbstractAuthRequestHandler.prototype.updateInboundSamlConfig = function (providerId, options) {
|
|
@@ -1557,19 +1601,21 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1557
1601
|
/**
|
|
1558
1602
|
* Invokes the request handler based on the API settings object passed.
|
|
1559
1603
|
*
|
|
1560
|
-
* @param
|
|
1561
|
-
* @param
|
|
1562
|
-
* @param
|
|
1563
|
-
* @param
|
|
1564
|
-
* @
|
|
1604
|
+
* @param urlBuilder - The URL builder for Auth endpoints.
|
|
1605
|
+
* @param apiSettings - The API endpoint settings to apply to request and response.
|
|
1606
|
+
* @param requestData - The request data.
|
|
1607
|
+
* @param additionalResourceParams - Additional resource related params if needed.
|
|
1608
|
+
* @returns A promise that resolves with the response.
|
|
1565
1609
|
*/
|
|
1566
1610
|
AbstractAuthRequestHandler.prototype.invokeRequestHandler = function (urlBuilder, apiSettings, requestData, additionalResourceParams) {
|
|
1567
1611
|
var _this = this;
|
|
1568
1612
|
return urlBuilder.getUrl(apiSettings.getEndpoint(), additionalResourceParams)
|
|
1569
1613
|
.then(function (url) {
|
|
1570
1614
|
// Validate request.
|
|
1571
|
-
|
|
1572
|
-
|
|
1615
|
+
if (requestData) {
|
|
1616
|
+
var requestValidator = apiSettings.getRequestValidator();
|
|
1617
|
+
requestValidator(requestData);
|
|
1618
|
+
}
|
|
1573
1619
|
// Process request.
|
|
1574
1620
|
var req = {
|
|
1575
1621
|
method: apiSettings.getHttpMethod(),
|
|
@@ -1602,7 +1648,7 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1602
1648
|
});
|
|
1603
1649
|
};
|
|
1604
1650
|
/**
|
|
1605
|
-
* @
|
|
1651
|
+
* @returns The current Auth user management resource URL builder.
|
|
1606
1652
|
*/
|
|
1607
1653
|
AbstractAuthRequestHandler.prototype.getAuthUrlBuilder = function () {
|
|
1608
1654
|
if (!this.authUrlBuilder) {
|
|
@@ -1611,7 +1657,7 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
|
|
|
1611
1657
|
return this.authUrlBuilder;
|
|
1612
1658
|
};
|
|
1613
1659
|
/**
|
|
1614
|
-
* @
|
|
1660
|
+
* @returns The current project config resource URL builder.
|
|
1615
1661
|
*/
|
|
1616
1662
|
AbstractAuthRequestHandler.prototype.getProjectConfigUrlBuilder = function () {
|
|
1617
1663
|
if (!this.projectConfigUrlBuilder) {
|
|
@@ -1680,7 +1726,7 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1680
1726
|
/**
|
|
1681
1727
|
* The FirebaseAuthRequestHandler constructor used to initialize an instance using a FirebaseApp.
|
|
1682
1728
|
*
|
|
1683
|
-
* @param
|
|
1729
|
+
* @param app - The app used to fetch access tokens to sign API requests.
|
|
1684
1730
|
* @constructor.
|
|
1685
1731
|
*/
|
|
1686
1732
|
function AuthRequestHandler(app) {
|
|
@@ -1689,13 +1735,13 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1689
1735
|
return _this;
|
|
1690
1736
|
}
|
|
1691
1737
|
/**
|
|
1692
|
-
* @
|
|
1738
|
+
* @returns A new Auth user management resource URL builder instance.
|
|
1693
1739
|
*/
|
|
1694
1740
|
AuthRequestHandler.prototype.newAuthUrlBuilder = function () {
|
|
1695
1741
|
return new AuthResourceUrlBuilder(this.app, 'v1');
|
|
1696
1742
|
};
|
|
1697
1743
|
/**
|
|
1698
|
-
* @
|
|
1744
|
+
* @returns A new project config resource URL builder instance.
|
|
1699
1745
|
*/
|
|
1700
1746
|
AuthRequestHandler.prototype.newProjectConfigUrlBuilder = function () {
|
|
1701
1747
|
return new AuthResourceUrlBuilder(this.app, 'v2');
|
|
@@ -1703,8 +1749,8 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1703
1749
|
/**
|
|
1704
1750
|
* Looks up a tenant by tenant ID.
|
|
1705
1751
|
*
|
|
1706
|
-
* @param
|
|
1707
|
-
* @
|
|
1752
|
+
* @param tenantId - The tenant identifier of the tenant to lookup.
|
|
1753
|
+
* @returns A promise that resolves with the tenant information.
|
|
1708
1754
|
*/
|
|
1709
1755
|
AuthRequestHandler.prototype.getTenant = function (tenantId) {
|
|
1710
1756
|
if (!validator.isNonEmptyString(tenantId)) {
|
|
@@ -1719,12 +1765,12 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1719
1765
|
* Exports the tenants (single batch only) with a size of maxResults and starting from
|
|
1720
1766
|
* the offset as specified by pageToken.
|
|
1721
1767
|
*
|
|
1722
|
-
* @param
|
|
1768
|
+
* @param maxResults - The page size, 1000 if undefined. This is also the maximum
|
|
1723
1769
|
* allowed limit.
|
|
1724
|
-
* @param
|
|
1770
|
+
* @param pageToken - The next page token. If not specified, returns tenants starting
|
|
1725
1771
|
* without any offset. Tenants are returned in the order they were created from oldest to
|
|
1726
1772
|
* newest, relative to the page token offset.
|
|
1727
|
-
* @
|
|
1773
|
+
* @returns A promise that resolves with the current batch of downloaded
|
|
1728
1774
|
* tenants and the next page token if available. For the last page, an empty list of tenants
|
|
1729
1775
|
* and no page token are returned.
|
|
1730
1776
|
*/
|
|
@@ -1750,14 +1796,14 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1750
1796
|
/**
|
|
1751
1797
|
* Deletes a tenant identified by a tenantId.
|
|
1752
1798
|
*
|
|
1753
|
-
* @param
|
|
1754
|
-
* @
|
|
1799
|
+
* @param tenantId - The identifier of the tenant to delete.
|
|
1800
|
+
* @returns A promise that resolves when the tenant is deleted.
|
|
1755
1801
|
*/
|
|
1756
1802
|
AuthRequestHandler.prototype.deleteTenant = function (tenantId) {
|
|
1757
1803
|
if (!validator.isNonEmptyString(tenantId)) {
|
|
1758
1804
|
return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_TENANT_ID));
|
|
1759
1805
|
}
|
|
1760
|
-
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT,
|
|
1806
|
+
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, undefined, { tenantId: tenantId })
|
|
1761
1807
|
.then(function () {
|
|
1762
1808
|
// Return nothing.
|
|
1763
1809
|
});
|
|
@@ -1765,8 +1811,8 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1765
1811
|
/**
|
|
1766
1812
|
* Creates a new tenant with the properties provided.
|
|
1767
1813
|
*
|
|
1768
|
-
* @param
|
|
1769
|
-
* @
|
|
1814
|
+
* @param tenantOptions - The properties to set on the new tenant to be created.
|
|
1815
|
+
* @returns A promise that resolves with the newly created tenant object.
|
|
1770
1816
|
*/
|
|
1771
1817
|
AuthRequestHandler.prototype.createTenant = function (tenantOptions) {
|
|
1772
1818
|
try {
|
|
@@ -1784,9 +1830,9 @@ var AuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1784
1830
|
/**
|
|
1785
1831
|
* Updates an existing tenant with the properties provided.
|
|
1786
1832
|
*
|
|
1787
|
-
* @param
|
|
1788
|
-
* @param
|
|
1789
|
-
* @
|
|
1833
|
+
* @param tenantId - The tenant identifier of the tenant to update.
|
|
1834
|
+
* @param tenantOptions - The properties to update on the existing tenant.
|
|
1835
|
+
* @returns A promise that resolves with the modified tenant object.
|
|
1790
1836
|
*/
|
|
1791
1837
|
AuthRequestHandler.prototype.updateTenant = function (tenantId, tenantOptions) {
|
|
1792
1838
|
if (!validator.isNonEmptyString(tenantId)) {
|
|
@@ -1821,8 +1867,8 @@ var TenantAwareAuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1821
1867
|
* The FirebaseTenantRequestHandler constructor used to initialize an instance using a
|
|
1822
1868
|
* FirebaseApp and a tenant ID.
|
|
1823
1869
|
*
|
|
1824
|
-
* @param
|
|
1825
|
-
* @param
|
|
1870
|
+
* @param app - The app used to fetch access tokens to sign API requests.
|
|
1871
|
+
* @param tenantId - The request handler's tenant ID.
|
|
1826
1872
|
* @constructor
|
|
1827
1873
|
*/
|
|
1828
1874
|
function TenantAwareAuthRequestHandler(app, tenantId) {
|
|
@@ -1831,13 +1877,13 @@ var TenantAwareAuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1831
1877
|
return _this;
|
|
1832
1878
|
}
|
|
1833
1879
|
/**
|
|
1834
|
-
* @
|
|
1880
|
+
* @returns A new Auth user management resource URL builder instance.
|
|
1835
1881
|
*/
|
|
1836
1882
|
TenantAwareAuthRequestHandler.prototype.newAuthUrlBuilder = function () {
|
|
1837
1883
|
return new TenantAwareAuthResourceUrlBuilder(this.app, 'v1', this.tenantId);
|
|
1838
1884
|
};
|
|
1839
1885
|
/**
|
|
1840
|
-
* @
|
|
1886
|
+
* @returns A new project config resource URL builder instance.
|
|
1841
1887
|
*/
|
|
1842
1888
|
TenantAwareAuthRequestHandler.prototype.newProjectConfigUrlBuilder = function () {
|
|
1843
1889
|
return new TenantAwareAuthResourceUrlBuilder(this.app, 'v2', this.tenantId);
|
|
@@ -1851,10 +1897,10 @@ var TenantAwareAuthRequestHandler = /** @class */ (function (_super) {
|
|
|
1851
1897
|
* Overrides the superclass methods by adding an additional check to match tenant IDs of
|
|
1852
1898
|
* imported user records if present.
|
|
1853
1899
|
*
|
|
1854
|
-
* @param
|
|
1855
|
-
* @param
|
|
1900
|
+
* @param users - The list of user records to import to Firebase Auth.
|
|
1901
|
+
* @param options - The user import options, required when the users provided
|
|
1856
1902
|
* include password credentials.
|
|
1857
|
-
* @
|
|
1903
|
+
* @returns A promise that resolves when the operation completes
|
|
1858
1904
|
* with the result of the import. This includes the number of successful imports, the number
|
|
1859
1905
|
* of failed uploads and their corresponding errors.
|
|
1860
1906
|
*/
|
|
@@ -1878,10 +1924,6 @@ function emulatorHost() {
|
|
|
1878
1924
|
/**
|
|
1879
1925
|
* When true the SDK should communicate with the Auth Emulator for all API
|
|
1880
1926
|
* calls and also produce unsigned tokens.
|
|
1881
|
-
*
|
|
1882
|
-
* This alone does <b>NOT<b> short-circuit ID Token verification.
|
|
1883
|
-
* For security reasons that must be explicitly disabled through
|
|
1884
|
-
* setJwtVerificationEnabled(false);
|
|
1885
1927
|
*/
|
|
1886
1928
|
function useEmulator() {
|
|
1887
1929
|
return !!emulatorHost();
|