strapi-plugin-firebase-authentication 1.0.13 → 1.1.0
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 +415 -191
- package/dist/_chunks/App-Bl6D4TFu.mjs +6197 -0
- package/dist/_chunks/App-HfsY_18f.js +6181 -0
- package/dist/_chunks/{api-4hcml0jk.mjs → api-B01IAVEC.mjs} +14 -3
- package/dist/_chunks/{api-DPtT1Bpu.js → api-BSejy8nn.js} +14 -3
- package/dist/_chunks/index-4hUrKd7Y.mjs +815 -0
- package/dist/_chunks/index-BbVqBI3M.js +859 -0
- package/dist/_chunks/index-BqF9RRVF.mjs +859 -0
- package/dist/_chunks/index-DgfRCyyQ.js +814 -0
- package/dist/admin/index.js +6 -1
- package/dist/admin/index.mjs +7 -2
- package/dist/admin/src/components/PasswordResetButton/PasswordResetButton.d.ts +11 -0
- package/dist/admin/src/components/PasswordResetButton/index.d.ts +1 -0
- package/dist/admin/src/components/common/Header/Header.d.ts +12 -0
- package/dist/admin/src/components/common/index.d.ts +3 -0
- package/dist/admin/src/components/forms/CreateUserForm/CreateUserForm.d.ts +2 -0
- package/dist/admin/src/components/forms/EditUserForm/EditUserForm.d.ts +6 -0
- package/dist/admin/src/components/forms/index.d.ts +4 -0
- package/dist/admin/src/components/forms/shared/UserFormFields/UserFormFields.d.ts +17 -0
- package/dist/admin/src/components/forms/shared/UserFormLayout/UserFormLayout.d.ts +7 -0
- package/dist/admin/src/components/index.d.ts +5 -0
- package/dist/admin/src/components/search/SearchURLQuery/SearchURLQuery.d.ts +6 -0
- package/dist/admin/src/components/search/index.d.ts +1 -0
- package/dist/admin/src/components/{DynamicTable → table/FirebaseTable}/FirebaseTable.d.ts +3 -2
- package/dist/admin/src/components/{DynamicTable → table}/FirebaseTableRows/FirebaseTableRows.d.ts +2 -2
- package/dist/admin/src/components/table/index.d.ts +3 -0
- package/dist/admin/src/components/user-management/ResetPassword/ResetPassword.d.ts +12 -0
- package/dist/admin/src/components/user-management/index.d.ts +2 -0
- package/dist/admin/src/hooks/useBulkSelection.d.ts +14 -0
- package/dist/admin/src/hooks/useUserForm.d.ts +18 -0
- package/dist/admin/src/pages/CreateView.d.ts +1 -0
- package/dist/admin/src/pages/EditView.d.ts +1 -0
- package/dist/admin/src/pages/ListView/index.d.ts +3 -5
- package/dist/admin/src/pages/Settings/api.d.ts +20 -1
- package/dist/admin/src/pages/utils/api.d.ts +4 -1
- package/dist/admin/src/utils/hasPasswordProvider.d.ts +15 -0
- package/dist/admin/src/utils/validation.d.ts +16 -0
- package/dist/model/Request.d.ts +2 -0
- package/dist/model/User.d.ts +6 -0
- package/dist/server/index.js +6564 -931
- package/dist/server/index.mjs +6518 -902
- package/dist/server/src/config/index.d.ts +36 -1
- package/dist/server/src/constants/index.d.ts +107 -0
- package/dist/server/src/content-types/index.d.ts +82 -0
- package/dist/server/src/controllers/firebaseController.d.ts +32 -2
- package/dist/server/src/controllers/index.d.ts +16 -10
- package/dist/server/src/controllers/settingsController.d.ts +2 -0
- package/dist/server/src/controllers/userController.d.ts +1 -0
- package/dist/server/src/index.d.ts +194 -27
- package/dist/server/src/migrations/migrate-firebase-user-data.d.ts +30 -0
- package/dist/server/src/routes/admin.d.ts +1 -1
- package/dist/server/src/routes/content-api.d.ts +1 -0
- package/dist/server/src/routes/content-internal-api.d.ts +1 -1
- package/dist/server/src/routes/index.d.ts +3 -2
- package/dist/server/src/routes/settingsRoutes.d.ts +1 -1
- package/dist/server/src/services/autoLinkService.d.ts +29 -0
- package/dist/server/src/services/emailService.d.ts +32 -0
- package/dist/server/src/services/firebaseService.d.ts +87 -13
- package/dist/server/src/services/firebaseStrapiLinkService.d.ts +34 -0
- package/dist/server/src/services/firebaseUserDataService.d.ts +26 -0
- package/dist/server/src/services/index.d.ts +91 -16
- package/dist/server/src/services/settingsService.d.ts +55 -0
- package/dist/server/src/services/templateService.d.ts +21 -0
- package/dist/server/src/services/userService.d.ts +2 -1
- package/dist/server/src/templates/defaults/index.d.ts +2 -0
- package/dist/server/src/templates/defaults/magic-link.d.ts +2 -0
- package/dist/server/src/templates/defaults/password-reset.d.ts +2 -0
- package/dist/server/src/templates/types.d.ts +30 -0
- package/dist/server/src/utils/fetch-me.d.ts +2 -10
- package/dist/server/src/utils/get-user-by-id.d.ts +1 -5
- package/dist/server/src/utils/users.d.ts +14 -0
- package/package.json +32 -22
- package/dist/_chunks/App-B2LtHk9g.js +0 -5062
- package/dist/_chunks/App-B3HcVa5j.mjs +0 -5081
- package/dist/_chunks/index-CALp4X47.mjs +0 -110
- package/dist/_chunks/index-CrGRt-Ya.mjs +0 -191
- package/dist/_chunks/index-DMBPEFUy.js +0 -109
- package/dist/_chunks/index-DmTKNKJB.js +0 -191
- package/dist/admin/src/components/SearchURLQuery/SearchURLQuery.d.ts +0 -18
- package/dist/admin/src/components/UserManagement/ResetPassword.d.ts +0 -8
- /package/dist/admin/src/components/{Initializer.d.ts → common/Initializer/Initializer.d.ts} +0 -0
- /package/dist/admin/src/components/{PluginIcon.d.ts → common/PluginIcon/PluginIcon.d.ts} +0 -0
- /package/dist/admin/src/components/{DynamicTable → table/FirebaseTable}/TableHeaders.d.ts +0 -0
- /package/dist/admin/src/components/{UserManagement → user-management/DeleteAccount}/DeleteAccount.d.ts +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Config for
|
|
2
|
+
* Config for Firebase Authentication Plugin
|
|
3
|
+
*
|
|
4
|
+
* Available email pattern tokens for phone-only users:
|
|
5
|
+
*
|
|
6
|
+
* {randomString} - Generates 8-character random alphanumeric string (lowercase)
|
|
7
|
+
* Example: "a1b2c3d4"
|
|
8
|
+
*
|
|
9
|
+
* {phoneNumber} - Extracts digits from phone number
|
|
10
|
+
* Example: "+1-234-567-8900" → "12345678900"
|
|
11
|
+
*
|
|
12
|
+
* {timestamp} - Current Unix timestamp in milliseconds
|
|
13
|
+
* Example: "1704067200000"
|
|
14
|
+
*
|
|
15
|
+
* Pattern Examples:
|
|
16
|
+
* - "{randomString}@phone-user.firebase.local" → "a1b2c3d4@phone-user.firebase.local"
|
|
17
|
+
* - "phone_{phoneNumber}@myapp.local" → "phone_12345678900@myapp.local"
|
|
18
|
+
* - "user_{timestamp}@temp.local" → "user_1704067200000@temp.local"
|
|
19
|
+
* - "{phoneNumber}_{randomString}@app.com" → "12345678900_a1b2c3d4@app.com"
|
|
20
|
+
*
|
|
21
|
+
* IMPORTANT: Pattern must include at least one of {randomString} or {timestamp}
|
|
22
|
+
* to ensure uniqueness across multiple users.
|
|
3
23
|
*/
|
|
4
24
|
export type FirebaseAuthConfig = {
|
|
5
25
|
/**
|
|
@@ -8,12 +28,27 @@ export type FirebaseAuthConfig = {
|
|
|
8
28
|
* @default 'your-key-here'
|
|
9
29
|
*/
|
|
10
30
|
firebaseJsonEncryptionKey: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to generate dummy emails for phone-only users
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
emailRequired?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Template pattern for generating dummy emails
|
|
39
|
+
* Must include {randomString} or {timestamp} for uniqueness
|
|
40
|
+
*
|
|
41
|
+
* @default '{randomString}@phone-user.firebase.local'
|
|
42
|
+
*/
|
|
43
|
+
emailPattern?: string;
|
|
11
44
|
};
|
|
12
45
|
declare const _default: {
|
|
13
46
|
default: ({ env }: {
|
|
14
47
|
env: any;
|
|
15
48
|
}) => {
|
|
16
49
|
firebaseJsonEncryptionKey: any;
|
|
50
|
+
emailRequired: boolean;
|
|
51
|
+
emailPattern: string;
|
|
17
52
|
};
|
|
18
53
|
validator(config: FirebaseAuthConfig): void;
|
|
19
54
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for Firebase Authentication Plugin
|
|
3
|
+
* This file centralizes all magic strings and configuration defaults
|
|
4
|
+
*/
|
|
5
|
+
export declare const PLUGIN_NAME = "firebase-authentication";
|
|
6
|
+
export declare const PLUGIN_UID = "plugin::firebase-authentication";
|
|
7
|
+
export declare const CONFIG_CONTENT_TYPE = "plugin::firebase-authentication.firebase-authentication-configuration";
|
|
8
|
+
export declare const USER_CONTENT_TYPE = "plugin::users-permissions.user";
|
|
9
|
+
export declare const USER_PERMISSIONS_PLUGIN = "users-permissions";
|
|
10
|
+
export declare const DEFAULT_PASSWORD_RESET_URL = "http://localhost:3000/reset-password";
|
|
11
|
+
export declare const DEFAULT_PASSWORD_REGEX = "^.{6,}$";
|
|
12
|
+
export declare const DEFAULT_PASSWORD_MESSAGE = "Password must be at least 6 characters long";
|
|
13
|
+
export declare const DEFAULT_EMAIL_PATTERN = "{randomString}@phone-user.firebase.local";
|
|
14
|
+
export declare const DEFAULT_RESET_EMAIL_SUBJECT = "Reset Your Password";
|
|
15
|
+
export declare const API_PREFIX = "/api/firebase-authentication";
|
|
16
|
+
export declare const FIREBASE_AUTH_URL = "https://identitytoolkit.googleapis.com/v1/accounts";
|
|
17
|
+
export declare const ERROR_MESSAGES: {
|
|
18
|
+
FIREBASE_NOT_INITIALIZED: string;
|
|
19
|
+
INVALID_JSON: string;
|
|
20
|
+
MISSING_DATA: string;
|
|
21
|
+
SOMETHING_WENT_WRONG: string;
|
|
22
|
+
AUTHENTICATION_FAILED: string;
|
|
23
|
+
TOKEN_MISSING: string;
|
|
24
|
+
EMAIL_PASSWORD_REQUIRED: string;
|
|
25
|
+
PASSWORD_REQUIRED: string;
|
|
26
|
+
AUTHORIZATION_REQUIRED: string;
|
|
27
|
+
INVALID_TOKEN: string;
|
|
28
|
+
USER_NOT_FOUND: string;
|
|
29
|
+
USER_NO_EMAIL: string;
|
|
30
|
+
FIREBASE_LINK_FAILED: string;
|
|
31
|
+
CONFIG_NOT_FOUND: string;
|
|
32
|
+
INVALID_SERVICE_ACCOUNT: string;
|
|
33
|
+
WEB_API_NOT_CONFIGURED: string;
|
|
34
|
+
RESET_URL_NOT_CONFIGURED: string;
|
|
35
|
+
RESET_URL_MUST_BE_HTTPS: string;
|
|
36
|
+
RESET_URL_INVALID_FORMAT: string;
|
|
37
|
+
USER_NOT_LINKED_FIREBASE: string;
|
|
38
|
+
OVERRIDE_USER_ID_REQUIRED: string;
|
|
39
|
+
EITHER_EMAIL_OR_PHONE_REQUIRED: string;
|
|
40
|
+
DELETION_NO_CONFIG: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const SUCCESS_MESSAGES: {
|
|
43
|
+
FIREBASE_INITIALIZED: string;
|
|
44
|
+
FIREBASE_CONFIG_DELETED: string;
|
|
45
|
+
PASSWORD_RESET_EMAIL_SENT: string;
|
|
46
|
+
SERVER_RESTARTING: string;
|
|
47
|
+
};
|
|
48
|
+
export declare const CONFIG_KEYS: {
|
|
49
|
+
ENCRYPTION_KEY: string;
|
|
50
|
+
};
|
|
51
|
+
export declare const FIELD_NAMES: {
|
|
52
|
+
FIREBASE_CONFIG_JSON: string;
|
|
53
|
+
FIREBASE_WEB_API_KEY: string;
|
|
54
|
+
PASSWORD_REGEX: string;
|
|
55
|
+
PASSWORD_MESSAGE: string;
|
|
56
|
+
PASSWORD_RESET_URL: string;
|
|
57
|
+
PASSWORD_RESET_EMAIL_SUBJECT: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const LOG_LEVELS: {
|
|
60
|
+
DEBUG: string;
|
|
61
|
+
INFO: string;
|
|
62
|
+
WARN: string;
|
|
63
|
+
ERROR: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const USER_ROLES: {
|
|
66
|
+
DEFAULT_TYPE: string;
|
|
67
|
+
};
|
|
68
|
+
export declare const TIME_CONSTANTS: {
|
|
69
|
+
JWT_EXPIRY: string;
|
|
70
|
+
EMAIL_TIMEOUT_MS: number;
|
|
71
|
+
FIREBASE_TIMEOUT_MS: number;
|
|
72
|
+
};
|
|
73
|
+
export declare const FIREBASE_ERROR_CODES: {
|
|
74
|
+
EMAIL_NOT_FOUND: string;
|
|
75
|
+
INVALID_PASSWORD: string;
|
|
76
|
+
USER_DISABLED: string;
|
|
77
|
+
INVALID_EMAIL: string;
|
|
78
|
+
USER_NOT_FOUND: string;
|
|
79
|
+
};
|
|
80
|
+
export declare const FIREBASE_USER_ERROR_MESSAGES: {
|
|
81
|
+
EMAIL_NOT_FOUND: string;
|
|
82
|
+
INVALID_PASSWORD: string;
|
|
83
|
+
USER_DISABLED: string;
|
|
84
|
+
INVALID_EMAIL: string;
|
|
85
|
+
INVALID_LOGIN_CREDENTIALS: string;
|
|
86
|
+
};
|
|
87
|
+
export declare const REQUIRED_FIELDS: {
|
|
88
|
+
SERVICE_ACCOUNT: string[];
|
|
89
|
+
WEB_CONFIG: string[];
|
|
90
|
+
};
|
|
91
|
+
export declare const VALIDATION_MESSAGES: {
|
|
92
|
+
INVALID_SERVICE_ACCOUNT: string;
|
|
93
|
+
WRONG_JSON_TYPE: string;
|
|
94
|
+
SERVICE_ACCOUNT_HELP: string;
|
|
95
|
+
};
|
|
96
|
+
export declare const EMAIL_PATTERNS: {
|
|
97
|
+
APPLE_RELAY: string;
|
|
98
|
+
};
|
|
99
|
+
export declare const REGEX_PATTERNS: {
|
|
100
|
+
PHONE_NUMBER: RegExp;
|
|
101
|
+
STRAPI_ID: RegExp;
|
|
102
|
+
PHONE_PREFIX: RegExp;
|
|
103
|
+
};
|
|
104
|
+
export declare const MAX_RETRIES: {
|
|
105
|
+
EMAIL_GENERATION: number;
|
|
106
|
+
USERNAME_GENERATION: number;
|
|
107
|
+
};
|
|
@@ -23,6 +23,88 @@ declare const _default: {
|
|
|
23
23
|
firebase_config_json: {
|
|
24
24
|
type: string;
|
|
25
25
|
};
|
|
26
|
+
firebase_web_api_key: {
|
|
27
|
+
type: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
configurable: boolean;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
passwordRequirementsRegex: {
|
|
33
|
+
type: string;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
passwordRequirementsMessage: {
|
|
37
|
+
type: string;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
passwordResetUrl: {
|
|
41
|
+
type: string;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
44
|
+
passwordResetEmailSubject: {
|
|
45
|
+
type: string;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
enableMagicLink: {
|
|
49
|
+
type: string;
|
|
50
|
+
default: boolean;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
magicLinkUrl: {
|
|
54
|
+
type: string;
|
|
55
|
+
default: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
magicLinkEmailSubject: {
|
|
59
|
+
type: string;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
magicLinkExpiryHours: {
|
|
63
|
+
type: string;
|
|
64
|
+
default: number;
|
|
65
|
+
minimum: number;
|
|
66
|
+
maximum: number;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
"firebase-user-data": {
|
|
73
|
+
schema: {
|
|
74
|
+
kind: string;
|
|
75
|
+
collectionName: string;
|
|
76
|
+
info: {
|
|
77
|
+
singularName: string;
|
|
78
|
+
pluralName: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
options: {
|
|
83
|
+
draftAndPublish: boolean;
|
|
84
|
+
};
|
|
85
|
+
pluginOptions: {
|
|
86
|
+
"content-manager": {
|
|
87
|
+
visible: boolean;
|
|
88
|
+
};
|
|
89
|
+
"content-type-builder": {
|
|
90
|
+
visible: boolean;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
attributes: {
|
|
94
|
+
user: {
|
|
95
|
+
type: string;
|
|
96
|
+
relation: string;
|
|
97
|
+
target: string;
|
|
98
|
+
};
|
|
99
|
+
firebaseUserID: {
|
|
100
|
+
type: string;
|
|
101
|
+
unique: boolean;
|
|
102
|
+
required: boolean;
|
|
103
|
+
};
|
|
104
|
+
appleEmail: {
|
|
105
|
+
type: string;
|
|
106
|
+
private: boolean;
|
|
107
|
+
};
|
|
26
108
|
};
|
|
27
109
|
};
|
|
28
110
|
};
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
1
2
|
declare const firebaseController: {
|
|
2
|
-
validateToken(ctx: any): Promise<
|
|
3
|
+
validateToken(ctx: any): Promise<any>;
|
|
3
4
|
createAlias(ctx: any): Promise<void>;
|
|
4
5
|
deleteByEmail(email: any): Promise<any>;
|
|
5
|
-
overrideAccess(ctx: any): Promise<
|
|
6
|
+
overrideAccess(ctx: any): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Controller method for email/password authentication
|
|
9
|
+
* Handles the `/api/firebase-authentication/emailLogin` endpoint
|
|
10
|
+
*
|
|
11
|
+
* @param ctx - Koa context object
|
|
12
|
+
* @returns Promise that sets ctx.body with user data and JWT or error message
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This controller acts as a proxy to Firebase's Identity Toolkit API,
|
|
16
|
+
* allowing users to authenticate with email/password and receive a Strapi JWT.
|
|
17
|
+
*
|
|
18
|
+
* HTTP Status Codes:
|
|
19
|
+
* - `400`: Validation errors (missing credentials, invalid email/password)
|
|
20
|
+
* - `500`: Server errors (missing configuration, Firebase API issues)
|
|
21
|
+
*/
|
|
22
|
+
emailLogin(ctx: any): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Forgot password - sends reset email
|
|
25
|
+
* POST /api/firebase-authentication/forgotPassword
|
|
26
|
+
* Public endpoint - no authentication required
|
|
27
|
+
*/
|
|
28
|
+
forgotPassword(ctx: any): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Reset password - authenticated with 1hr JWT
|
|
31
|
+
* POST /api/firebase-authentication/resetPassword
|
|
32
|
+
* Public endpoint - uses JWT from Authorization header
|
|
33
|
+
*/
|
|
34
|
+
resetPassword(ctx: any): Promise<void>;
|
|
35
|
+
requestMagicLink(ctx: Context): Promise<void>;
|
|
6
36
|
};
|
|
7
37
|
export default firebaseController;
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
/// <reference types="koa" />
|
|
2
1
|
declare const _default: {
|
|
3
2
|
firebaseController: {
|
|
4
|
-
validateToken(ctx: any): Promise<
|
|
3
|
+
validateToken(ctx: any): Promise<any>;
|
|
5
4
|
createAlias(ctx: any): Promise<void>;
|
|
6
5
|
deleteByEmail(email: any): Promise<any>;
|
|
7
|
-
overrideAccess(ctx: any): Promise<
|
|
6
|
+
overrideAccess(ctx: any): Promise<any>;
|
|
7
|
+
emailLogin(ctx: any): Promise<void>;
|
|
8
|
+
forgotPassword(ctx: any): Promise<void>;
|
|
9
|
+
resetPassword(ctx: any): Promise<void>;
|
|
10
|
+
requestMagicLink(ctx: import("koa").Context): Promise<void>;
|
|
8
11
|
};
|
|
9
12
|
userController: {
|
|
10
|
-
list: (ctx: import("koa").
|
|
13
|
+
list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
11
14
|
create: (ctx: any) => Promise<void>;
|
|
12
15
|
get: (ctx: any) => Promise<void>;
|
|
13
16
|
update: (ctx: any) => Promise<void>;
|
|
14
|
-
delete: (ctx: import("koa").
|
|
17
|
+
delete: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
15
18
|
deleteMany: (ctx: any) => Promise<void>;
|
|
16
19
|
resetPassword: (ctx: any) => Promise<void>;
|
|
20
|
+
sendResetEmail: (ctx: any) => Promise<void>;
|
|
17
21
|
};
|
|
18
22
|
settingsController: {
|
|
19
|
-
setToken: (ctx: import("koa").
|
|
20
|
-
setFirebaseConfigJson: (ctx: import("koa").
|
|
21
|
-
getFirebaseConfigJson: (ctx: import("koa").
|
|
22
|
-
delFirebaseConfigJson(ctx: import("koa").
|
|
23
|
-
restart(ctx: import("koa").
|
|
23
|
+
setToken: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
24
|
+
setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
25
|
+
getFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<any>;
|
|
26
|
+
delFirebaseConfigJson(ctx: import("koa").Context | import("koa").DefaultContext): Promise<void>;
|
|
27
|
+
restart(ctx: import("koa").Context | import("koa").DefaultContext): Promise<any>;
|
|
28
|
+
getPublicConfig(ctx: import("koa").Context | import("koa").DefaultContext): Promise<any>;
|
|
29
|
+
savePasswordConfig(ctx: import("koa").Context | import("koa").DefaultContext): Promise<void>;
|
|
24
30
|
};
|
|
25
31
|
};
|
|
26
32
|
export default _default;
|
|
@@ -5,5 +5,7 @@ declare const _default: {
|
|
|
5
5
|
getFirebaseConfigJson: (ctx: DefaultContext | Context) => Promise<any>;
|
|
6
6
|
delFirebaseConfigJson(ctx: DefaultContext | Context): Promise<void>;
|
|
7
7
|
restart(ctx: DefaultContext | Context): Promise<any>;
|
|
8
|
+
getPublicConfig(ctx: DefaultContext | Context): Promise<any>;
|
|
9
|
+
savePasswordConfig(ctx: DefaultContext | Context): Promise<void>;
|
|
8
10
|
};
|
|
9
11
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
2
|
declare const _default: {
|
|
3
3
|
register: ({ strapi }: {
|
|
4
4
|
strapi: import("@strapi/types/dist/core").Strapi;
|
|
@@ -14,31 +14,40 @@ declare const _default: {
|
|
|
14
14
|
env: any;
|
|
15
15
|
}) => {
|
|
16
16
|
firebaseJsonEncryptionKey: any;
|
|
17
|
+
emailRequired: boolean;
|
|
18
|
+
emailPattern: string;
|
|
17
19
|
};
|
|
18
20
|
validator(config: import("./config").FirebaseAuthConfig): void;
|
|
19
21
|
};
|
|
20
22
|
controllers: {
|
|
21
23
|
firebaseController: {
|
|
22
|
-
validateToken(ctx: any): Promise<
|
|
24
|
+
validateToken(ctx: any): Promise<any>;
|
|
23
25
|
createAlias(ctx: any): Promise<void>;
|
|
24
26
|
deleteByEmail(email: any): Promise<any>;
|
|
25
|
-
overrideAccess(ctx: any): Promise<
|
|
27
|
+
overrideAccess(ctx: any): Promise<any>;
|
|
28
|
+
emailLogin(ctx: any): Promise<void>;
|
|
29
|
+
forgotPassword(ctx: any): Promise<void>;
|
|
30
|
+
resetPassword(ctx: any): Promise<void>;
|
|
31
|
+
requestMagicLink(ctx: import("koa").Context): Promise<void>;
|
|
26
32
|
};
|
|
27
33
|
userController: {
|
|
28
|
-
list: (ctx: import("koa").
|
|
34
|
+
list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
29
35
|
create: (ctx: any) => Promise<void>;
|
|
30
36
|
get: (ctx: any) => Promise<void>;
|
|
31
37
|
update: (ctx: any) => Promise<void>;
|
|
32
|
-
delete: (ctx: import("koa").
|
|
38
|
+
delete: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
33
39
|
deleteMany: (ctx: any) => Promise<void>;
|
|
34
40
|
resetPassword: (ctx: any) => Promise<void>;
|
|
41
|
+
sendResetEmail: (ctx: any) => Promise<void>;
|
|
35
42
|
};
|
|
36
43
|
settingsController: {
|
|
37
|
-
setToken: (ctx: import("koa").
|
|
38
|
-
setFirebaseConfigJson: (ctx: import("koa").
|
|
39
|
-
getFirebaseConfigJson: (ctx: import("koa").
|
|
40
|
-
delFirebaseConfigJson(ctx: import("koa").
|
|
41
|
-
restart(ctx: import("koa").
|
|
44
|
+
setToken: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
45
|
+
setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
46
|
+
getFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<any>;
|
|
47
|
+
delFirebaseConfigJson(ctx: import("koa").Context | import("koa").DefaultContext): Promise<void>;
|
|
48
|
+
restart(ctx: import("koa").Context | import("koa").DefaultContext): Promise<any>;
|
|
49
|
+
getPublicConfig(ctx: import("koa").Context | import("koa").DefaultContext): Promise<any>;
|
|
50
|
+
savePasswordConfig(ctx: import("koa").Context | import("koa").DefaultContext): Promise<void>;
|
|
42
51
|
};
|
|
43
52
|
};
|
|
44
53
|
routes: {
|
|
@@ -49,7 +58,7 @@ declare const _default: {
|
|
|
49
58
|
path: string;
|
|
50
59
|
handler: string;
|
|
51
60
|
config: {
|
|
52
|
-
policies:
|
|
61
|
+
policies: string[];
|
|
53
62
|
};
|
|
54
63
|
}[];
|
|
55
64
|
};
|
|
@@ -60,6 +69,7 @@ declare const _default: {
|
|
|
60
69
|
path: string;
|
|
61
70
|
handler: string;
|
|
62
71
|
config: {
|
|
72
|
+
auth: boolean;
|
|
63
73
|
policies: any[];
|
|
64
74
|
};
|
|
65
75
|
}[];
|
|
@@ -70,7 +80,7 @@ declare const _default: {
|
|
|
70
80
|
path: string;
|
|
71
81
|
handler: string;
|
|
72
82
|
config: {
|
|
73
|
-
policies:
|
|
83
|
+
policies: string[];
|
|
74
84
|
};
|
|
75
85
|
}[];
|
|
76
86
|
};
|
|
@@ -82,9 +92,24 @@ declare const _default: {
|
|
|
82
92
|
init(): Promise<void>;
|
|
83
93
|
getFirebaseConfigJson(): Promise<{
|
|
84
94
|
firebaseConfigJson: any;
|
|
95
|
+
firebaseWebApiKey: any;
|
|
96
|
+
passwordRequirementsRegex: any;
|
|
97
|
+
passwordRequirementsMessage: any;
|
|
98
|
+
passwordResetUrl: any;
|
|
99
|
+
passwordResetEmailSubject: any;
|
|
100
|
+
enableMagicLink: any;
|
|
101
|
+
magicLinkUrl: any;
|
|
102
|
+
magicLinkEmailSubject: any;
|
|
103
|
+
magicLinkExpiryHours: any;
|
|
85
104
|
}>;
|
|
86
|
-
setFirebaseConfigJson(ctx: import("koa").
|
|
105
|
+
setFirebaseConfigJson(ctx: import("koa").Context | import("koa").DefaultContext): Promise<any>;
|
|
87
106
|
delFirebaseConfigJson: () => Promise<any>;
|
|
107
|
+
updateMagicLinkSettings(settings: any): Promise<{
|
|
108
|
+
enableMagicLink: any;
|
|
109
|
+
magicLinkUrl: any;
|
|
110
|
+
magicLinkEmailSubject: any;
|
|
111
|
+
magicLinkExpiryHours: any;
|
|
112
|
+
}>;
|
|
88
113
|
encryptJson(key: string, json: string): Promise<any>;
|
|
89
114
|
decryptJson(key: string, hash: string): Promise<any>;
|
|
90
115
|
restart(): Promise<void>;
|
|
@@ -95,7 +120,7 @@ declare const _default: {
|
|
|
95
120
|
get: (entityId: string) => Promise<any>;
|
|
96
121
|
create: (payload: any) => Promise<any>;
|
|
97
122
|
register: (userID: any, payload: any) => Promise<void>;
|
|
98
|
-
list: (pagination: any, nextPageToken: any) => Promise<{
|
|
123
|
+
list: (pagination: any, nextPageToken: any, sort: any, searchQuery: any) => Promise<{
|
|
99
124
|
data: any;
|
|
100
125
|
pageToken: any;
|
|
101
126
|
meta: {
|
|
@@ -112,6 +137,7 @@ declare const _default: {
|
|
|
112
137
|
deleteStrapiUser: (entityId: any) => Promise<any>;
|
|
113
138
|
deleteMany: (entityIDs: any) => Promise<any>;
|
|
114
139
|
setSocialMetaData(): Promise<void>;
|
|
140
|
+
sendPasswordResetEmail: (entityId: any) => Promise<any>;
|
|
115
141
|
};
|
|
116
142
|
firebaseService: ({ strapi }: {
|
|
117
143
|
strapi: any;
|
|
@@ -122,26 +148,85 @@ declare const _default: {
|
|
|
122
148
|
}>;
|
|
123
149
|
validateExchangeTokenPayload: (requestPayload: any) => Promise<any>;
|
|
124
150
|
decodeIDToken: (idToken: any) => Promise<any>;
|
|
125
|
-
overrideFirebaseAccess: (
|
|
151
|
+
overrideFirebaseAccess: (overrideUserId: string, populate?: string[]) => Promise<{
|
|
152
|
+
user: any;
|
|
153
|
+
jwt: any;
|
|
154
|
+
}>;
|
|
126
155
|
checkIfUserExists(decodedToken: any): Promise<any>;
|
|
127
156
|
fetchUser: (decodedToken: any) => Promise<any>;
|
|
128
157
|
generateJWTForCurrentUser: (user: any) => Promise<any>;
|
|
129
158
|
createStrapiUser(decodedToken: any, idToken: any, profileMetaData: any): Promise<any>;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
user: {
|
|
137
|
-
id: import("@strapi/types/dist/data").ID;
|
|
138
|
-
} & {
|
|
139
|
-
[key: string]: any;
|
|
140
|
-
};
|
|
159
|
+
validateFirebaseToken: (idToken: string, profileMetaData?: any, populate?: string[]) => Promise<{
|
|
160
|
+
user: any;
|
|
161
|
+
jwt: any;
|
|
162
|
+
}>;
|
|
163
|
+
emailLogin: (email: string, password: string, populate?: string[]) => Promise<{
|
|
164
|
+
user: any;
|
|
141
165
|
jwt: any;
|
|
142
|
-
|
|
166
|
+
}>;
|
|
167
|
+
forgotPassword: (ctx: any) => Promise<{
|
|
168
|
+
message: string;
|
|
169
|
+
}>;
|
|
170
|
+
resetPassword: (ctx: any) => Promise<{
|
|
171
|
+
user: any;
|
|
172
|
+
jwt: any;
|
|
173
|
+
}>;
|
|
174
|
+
requestMagicLink(ctx: any): Promise<{
|
|
175
|
+
debug: {
|
|
176
|
+
linkSent: any;
|
|
177
|
+
email: string;
|
|
178
|
+
message: any;
|
|
179
|
+
};
|
|
180
|
+
success: boolean;
|
|
181
|
+
message: string;
|
|
182
|
+
requiresFrontend: boolean;
|
|
183
|
+
verificationUrl: any;
|
|
184
|
+
} | {
|
|
185
|
+
success: boolean;
|
|
186
|
+
message: string;
|
|
187
|
+
requiresFrontend: boolean;
|
|
188
|
+
verificationUrl: any;
|
|
143
189
|
}>;
|
|
144
190
|
};
|
|
191
|
+
templateService: ({ strapi }: {
|
|
192
|
+
strapi: any;
|
|
193
|
+
}) => {
|
|
194
|
+
getTemplate(templateType: import("./templates/types").TemplateType): Promise<import("./templates/types").EmailTemplate>;
|
|
195
|
+
compileTemplate(templateString: string): import("lodash").TemplateExecutor;
|
|
196
|
+
validateVariables(variables: Partial<import("./templates/types").TemplateVariables>, required: string[]): void;
|
|
197
|
+
};
|
|
198
|
+
emailService: ({ strapi }: {
|
|
199
|
+
strapi: any;
|
|
200
|
+
}) => {
|
|
201
|
+
sendTemplatedEmail(to: string, templateType: import("./templates/types").TemplateType, variables: Partial<import("./templates/types").TemplateVariables>): Promise<void>;
|
|
202
|
+
sendPasswordResetEmail(user: any, resetLink: string): Promise<{
|
|
203
|
+
success: boolean;
|
|
204
|
+
message: string;
|
|
205
|
+
}>;
|
|
206
|
+
sendMagicLinkEmail(email: string, magicLink: string, config: any): Promise<{
|
|
207
|
+
success: boolean;
|
|
208
|
+
message: string;
|
|
209
|
+
}>;
|
|
210
|
+
};
|
|
211
|
+
firebaseUserDataService: ({ strapi }: {
|
|
212
|
+
strapi: any;
|
|
213
|
+
}) => {
|
|
214
|
+
findOrCreateForUser(userId: string): Promise<any>;
|
|
215
|
+
getByFirebaseUID(firebaseUID: string): Promise<any>;
|
|
216
|
+
updateForUser(userId: string, data: {
|
|
217
|
+
firebaseUserID?: string;
|
|
218
|
+
appleEmail?: string;
|
|
219
|
+
}): Promise<any>;
|
|
220
|
+
};
|
|
221
|
+
autoLinkService: {
|
|
222
|
+
linkAllUsers(strapi: import("@strapi/types/dist/core").Strapi): Promise<import("./services/autoLinkService").LinkResult>;
|
|
223
|
+
};
|
|
224
|
+
firebaseStrapiLinkService: ({ strapi }: {
|
|
225
|
+
strapi: any;
|
|
226
|
+
}) => {
|
|
227
|
+
buildUserMap(): Promise<Map<any, any>>;
|
|
228
|
+
linkFirebaseUsers(firebaseUsers: any[], uidToUserMap: Map<string, any>, allStrapiUsers: any[]): any[];
|
|
229
|
+
};
|
|
145
230
|
};
|
|
146
231
|
contentTypes: {
|
|
147
232
|
"firebase-authentication-configuration": {
|
|
@@ -168,6 +253,88 @@ declare const _default: {
|
|
|
168
253
|
firebase_config_json: {
|
|
169
254
|
type: string;
|
|
170
255
|
};
|
|
256
|
+
firebase_web_api_key: {
|
|
257
|
+
type: string;
|
|
258
|
+
required: boolean;
|
|
259
|
+
configurable: boolean;
|
|
260
|
+
description: string;
|
|
261
|
+
};
|
|
262
|
+
passwordRequirementsRegex: {
|
|
263
|
+
type: string;
|
|
264
|
+
default: string;
|
|
265
|
+
};
|
|
266
|
+
passwordRequirementsMessage: {
|
|
267
|
+
type: string;
|
|
268
|
+
default: string;
|
|
269
|
+
};
|
|
270
|
+
passwordResetUrl: {
|
|
271
|
+
type: string;
|
|
272
|
+
default: string;
|
|
273
|
+
};
|
|
274
|
+
passwordResetEmailSubject: {
|
|
275
|
+
type: string;
|
|
276
|
+
default: string;
|
|
277
|
+
};
|
|
278
|
+
enableMagicLink: {
|
|
279
|
+
type: string;
|
|
280
|
+
default: boolean;
|
|
281
|
+
description: string;
|
|
282
|
+
};
|
|
283
|
+
magicLinkUrl: {
|
|
284
|
+
type: string;
|
|
285
|
+
default: string;
|
|
286
|
+
description: string;
|
|
287
|
+
};
|
|
288
|
+
magicLinkEmailSubject: {
|
|
289
|
+
type: string;
|
|
290
|
+
default: string;
|
|
291
|
+
};
|
|
292
|
+
magicLinkExpiryHours: {
|
|
293
|
+
type: string;
|
|
294
|
+
default: number;
|
|
295
|
+
minimum: number;
|
|
296
|
+
maximum: number;
|
|
297
|
+
description: string;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
"firebase-user-data": {
|
|
303
|
+
schema: {
|
|
304
|
+
kind: string;
|
|
305
|
+
collectionName: string;
|
|
306
|
+
info: {
|
|
307
|
+
singularName: string;
|
|
308
|
+
pluralName: string;
|
|
309
|
+
displayName: string;
|
|
310
|
+
description: string;
|
|
311
|
+
};
|
|
312
|
+
options: {
|
|
313
|
+
draftAndPublish: boolean;
|
|
314
|
+
};
|
|
315
|
+
pluginOptions: {
|
|
316
|
+
"content-manager": {
|
|
317
|
+
visible: boolean;
|
|
318
|
+
};
|
|
319
|
+
"content-type-builder": {
|
|
320
|
+
visible: boolean;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
attributes: {
|
|
324
|
+
user: {
|
|
325
|
+
type: string;
|
|
326
|
+
relation: string;
|
|
327
|
+
target: string;
|
|
328
|
+
};
|
|
329
|
+
firebaseUserID: {
|
|
330
|
+
type: string;
|
|
331
|
+
unique: boolean;
|
|
332
|
+
required: boolean;
|
|
333
|
+
};
|
|
334
|
+
appleEmail: {
|
|
335
|
+
type: string;
|
|
336
|
+
private: boolean;
|
|
337
|
+
};
|
|
171
338
|
};
|
|
172
339
|
};
|
|
173
340
|
};
|