@adminforth/two-factors-auth 3.3.9 → 4.0.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/build.log +2 -2
- package/custom/TwoFAModal.vue +4 -4
- package/custom/TwoFactorsConfirmation.vue +9 -10
- package/custom/TwoFactorsPasskeysSettings.vue +10 -10
- package/custom/utils.js +7 -8
- package/dist/custom/TwoFAModal.vue +4 -4
- package/dist/custom/TwoFactorsConfirmation.vue +9 -10
- package/dist/custom/TwoFactorsPasskeysSettings.vue +10 -10
- package/dist/custom/utils.js +7 -8
- package/dist/endpoints/registerPasskeyEndpoints.d.ts +2 -0
- package/dist/endpoints/registerPasskeyEndpoints.js +59 -0
- package/dist/endpoints/registerTwoFaEndpoints.d.ts +2 -0
- package/dist/endpoints/registerTwoFaEndpoints.js +46 -0
- package/dist/handlers/createPasskeyHandlers.d.ts +48 -0
- package/dist/handlers/createPasskeyHandlers.js +99 -0
- package/dist/handlers/createTwoFaHandlers.d.ts +56 -0
- package/dist/handlers/createTwoFaHandlers.js +167 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +51 -858
- package/dist/repositories/passkeyRepository.d.ts +18 -0
- package/dist/repositories/passkeyRepository.js +89 -0
- package/dist/repositories/userRepository.d.ts +14 -0
- package/dist/repositories/userRepository.js +45 -0
- package/dist/services/cookieService.d.ts +52 -0
- package/dist/services/cookieService.js +144 -0
- package/dist/services/passkeyService.d.ts +84 -0
- package/dist/services/passkeyService.js +369 -0
- package/dist/services/totpService.d.ts +21 -0
- package/dist/services/totpService.js +43 -0
- package/dist/services/verifyMfaConfirmation.d.ts +30 -0
- package/dist/services/verifyMfaConfirmation.js +67 -0
- package/dist/types.d.ts +116 -0
- package/dist/utils/errors.d.ts +4 -0
- package/dist/utils/errors.js +9 -0
- package/dist/utils/parsePeriod.d.ts +1 -0
- package/dist/utils/parsePeriod.js +17 -0
- package/dist/utils/types.d.ts +13 -0
- package/dist/utils/types.js +1 -0
- package/endpoints/registerPasskeyEndpoints.ts +61 -0
- package/endpoints/registerTwoFaEndpoints.ts +45 -0
- package/handlers/createPasskeyHandlers.ts +103 -0
- package/handlers/createTwoFaHandlers.ts +172 -0
- package/index.ts +57 -886
- package/package.json +1 -1
- package/repositories/passkeyRepository.ts +78 -0
- package/repositories/userRepository.ts +42 -0
- package/services/cookieService.ts +165 -0
- package/services/passkeyService.ts +375 -0
- package/services/totpService.ts +37 -0
- package/services/verifyMfaConfirmation.ts +92 -0
- package/tsconfig.json +1 -1
- package/utils/errors.ts +13 -0
- package/utils/parsePeriod.ts +19 -0
- package/utils/types.ts +17 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { errorMessage } from "../utils/errors.js";
|
|
11
|
+
export function createPasskeyHandlers(ctx) {
|
|
12
|
+
return {
|
|
13
|
+
createRegistrationOptions: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, response, cookies, headers }) {
|
|
14
|
+
const mode = body === null || body === void 0 ? void 0 : body.mode;
|
|
15
|
+
const confirmationResult = body === null || body === void 0 ? void 0 : body.confirmationResult;
|
|
16
|
+
const verificationResult = yield ctx.verifyMfaConfirmation(confirmationResult, {
|
|
17
|
+
adminUser: adminUser,
|
|
18
|
+
userPk: adminUser.pk,
|
|
19
|
+
cookies: cookies,
|
|
20
|
+
response: response,
|
|
21
|
+
extra: {
|
|
22
|
+
headers,
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (!verificationResult || !('ok' in verificationResult)) {
|
|
26
|
+
return { ok: false, error: 'error' in verificationResult ? verificationResult.error : 'Verification failed' };
|
|
27
|
+
}
|
|
28
|
+
return ctx.passkeyService.createRegistrationOptions(mode, adminUser, response);
|
|
29
|
+
}),
|
|
30
|
+
finishRegistration: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, cookies }) {
|
|
31
|
+
return ctx.passkeyService.finishRegistration(body, adminUser, cookies);
|
|
32
|
+
}),
|
|
33
|
+
createLoginOptions: (_a) => __awaiter(this, [_a], void 0, function* ({ response }) {
|
|
34
|
+
return ctx.passkeyService.createLoginOptions(response);
|
|
35
|
+
}),
|
|
36
|
+
getPasskeys: (_a) => __awaiter(this, [_a], void 0, function* ({ adminUser }) {
|
|
37
|
+
return ctx.passkeyService.getPasskeys(adminUser);
|
|
38
|
+
}),
|
|
39
|
+
deletePasskey: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser }) {
|
|
40
|
+
return ctx.passkeyService.deletePasskey(body.passkeyId, adminUser);
|
|
41
|
+
}),
|
|
42
|
+
renamePasskey: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser }) {
|
|
43
|
+
return ctx.passkeyService.renamePasskey(body.passkeyId, body.newName, adminUser);
|
|
44
|
+
}),
|
|
45
|
+
checkIfUserHasPasskeys: (_a) => __awaiter(this, [_a], void 0, function* ({ cookies }) {
|
|
46
|
+
return ctx.passkeyService.checkIfUserHasPasskeys(cookies);
|
|
47
|
+
}),
|
|
48
|
+
resolveVerifyAuto: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, response, cookies, headers }) {
|
|
49
|
+
var _b;
|
|
50
|
+
const sessionsIds = body === null || body === void 0 ? void 0 : body.sessionsIds;
|
|
51
|
+
const confirmationResult = body === null || body === void 0 ? void 0 : body.confirmationResult;
|
|
52
|
+
const idsToResolve = Array.isArray(sessionsIds) ? sessionsIds : [];
|
|
53
|
+
const resolveAllIdsAsFailed = (message, code) => {
|
|
54
|
+
const payload = code ? { ok: false, code, error: message } : { ok: false, error: message };
|
|
55
|
+
for (const id of idsToResolve) {
|
|
56
|
+
ctx.autoVerify.resolveResponse(id, payload);
|
|
57
|
+
}
|
|
58
|
+
return payload;
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
if (!idsToResolve.length || !confirmationResult) {
|
|
62
|
+
return (resolveAllIdsAsFailed('Confirmation window was closed', 'VERIFICATION_CANCELLED'));
|
|
63
|
+
}
|
|
64
|
+
for (const id of idsToResolve) {
|
|
65
|
+
const validationResult = yield ctx.adminforth.auth.verify(id, 'auto2FA', false);
|
|
66
|
+
if (!validationResult) {
|
|
67
|
+
return (resolveAllIdsAsFailed('Invalid session ID or confirmation result'));
|
|
68
|
+
}
|
|
69
|
+
if (validationResult.adminUserPk !== adminUser.pk) {
|
|
70
|
+
return (resolveAllIdsAsFailed('Session does not belong to the authenticated user'));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const verificationResult = yield ctx.verifyMfaConfirmation(confirmationResult, {
|
|
74
|
+
adminUser: adminUser,
|
|
75
|
+
userPk: adminUser.pk,
|
|
76
|
+
cookies: cookies,
|
|
77
|
+
response: response,
|
|
78
|
+
extra: {
|
|
79
|
+
headers: headers,
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (!verificationResult || !('ok' in verificationResult)) {
|
|
83
|
+
return (resolveAllIdsAsFailed((_b = verificationResult === null || verificationResult === void 0 ? void 0 : verificationResult.error) !== null && _b !== void 0 ? _b : 'Verification failed'));
|
|
84
|
+
}
|
|
85
|
+
if ('ok' in verificationResult && verificationResult.ok) {
|
|
86
|
+
for (const id of idsToResolve) {
|
|
87
|
+
ctx.autoVerify.resolveResponse(id, { ok: true, passkeyConfirmed: verificationResult });
|
|
88
|
+
}
|
|
89
|
+
return { ok: true };
|
|
90
|
+
}
|
|
91
|
+
return (resolveAllIdsAsFailed('Verification failed'));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('[AdminForth 2FA] Error resolving automatic 2FA verification', error);
|
|
95
|
+
return (resolveAllIdsAsFailed(errorMessage(error)));
|
|
96
|
+
}
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare function createTwoFaHandlers(ctx: any): {
|
|
2
|
+
initSetup: ({ cookies }: {
|
|
3
|
+
cookies: any;
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
totpJWT: any;
|
|
6
|
+
status: string;
|
|
7
|
+
}>;
|
|
8
|
+
confirmLogin: ({ body, response, cookies }: {
|
|
9
|
+
body: any;
|
|
10
|
+
response: any;
|
|
11
|
+
cookies: any;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
status: string;
|
|
14
|
+
allowedLogin: boolean;
|
|
15
|
+
error?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
error: any;
|
|
18
|
+
status?: undefined;
|
|
19
|
+
allowedLogin?: undefined;
|
|
20
|
+
}>;
|
|
21
|
+
confirmLoginWithPasskey: ({ body, response, cookies, headers, requestUrl, query }: {
|
|
22
|
+
body: any;
|
|
23
|
+
response: any;
|
|
24
|
+
cookies: any;
|
|
25
|
+
headers: any;
|
|
26
|
+
requestUrl: any;
|
|
27
|
+
query: any;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
allowedLogin: boolean;
|
|
30
|
+
error: string;
|
|
31
|
+
} | {
|
|
32
|
+
error: any;
|
|
33
|
+
}>;
|
|
34
|
+
skipAllow: ({ cookies }: {
|
|
35
|
+
cookies: any;
|
|
36
|
+
}) => Promise<{
|
|
37
|
+
status: string;
|
|
38
|
+
message: string;
|
|
39
|
+
skipAllowed?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
status: string;
|
|
42
|
+
skipAllowed: any;
|
|
43
|
+
message?: undefined;
|
|
44
|
+
}>;
|
|
45
|
+
skipAllowModal: ({ adminUser, headers, cookies }: {
|
|
46
|
+
adminUser: any;
|
|
47
|
+
headers: any;
|
|
48
|
+
cookies: any;
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
skipAllowed: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
verifyTotp: ({ adminUser, body }: {
|
|
53
|
+
adminUser: any;
|
|
54
|
+
body: any;
|
|
55
|
+
}) => Promise<any>;
|
|
56
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export function createTwoFaHandlers(ctx) {
|
|
11
|
+
return {
|
|
12
|
+
initSetup: (_a) => __awaiter(this, [_a], void 0, function* ({ cookies }) {
|
|
13
|
+
const toReturn = { totpJWT: null, status: 'ok', };
|
|
14
|
+
const totpTemporaryJWT = ctx.cookieService.getTotpTemporary(cookies);
|
|
15
|
+
if (totpTemporaryJWT) {
|
|
16
|
+
toReturn.totpJWT = totpTemporaryJWT;
|
|
17
|
+
}
|
|
18
|
+
return toReturn;
|
|
19
|
+
}),
|
|
20
|
+
confirmLogin: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, cookies }) {
|
|
21
|
+
var _b, _c;
|
|
22
|
+
const totpTemporaryJWT = ctx.cookieService.getTotpTemporary(cookies);
|
|
23
|
+
if (!totpTemporaryJWT) {
|
|
24
|
+
return { error: 'Login session expired. Please log in again.' };
|
|
25
|
+
}
|
|
26
|
+
const decoded = yield ctx.cookieService.verifyTotpTemporary(cookies);
|
|
27
|
+
if (!decoded) {
|
|
28
|
+
return { error: 'Login session expired. Please log in again.' };
|
|
29
|
+
}
|
|
30
|
+
if (decoded.newSecret) {
|
|
31
|
+
const verified = body.skip && decoded.userCanSkipSetup ? true : ctx.totpService.verifySecret(decoded.newSecret, body.code);
|
|
32
|
+
if (verified) {
|
|
33
|
+
if (!body.skip) {
|
|
34
|
+
yield ctx.totpService.saveSecret(decoded.pk, decoded.newSecret);
|
|
35
|
+
}
|
|
36
|
+
ctx.cookieService.removeTotpTemporary(response);
|
|
37
|
+
ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
38
|
+
return { status: 'ok', allowedLogin: true };
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return { error: 'Wrong or expired OTP code' };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let verified = false;
|
|
45
|
+
let verificationError = 'Wrong or expired OTP code';
|
|
46
|
+
if (body.usePasskey && ctx.options.passkeys) {
|
|
47
|
+
const cookiesValidationResult = yield ctx.passkeyService.validateLoginChallengeCookie(cookies);
|
|
48
|
+
if (!cookiesValidationResult.ok) {
|
|
49
|
+
return { error: cookiesValidationResult.error };
|
|
50
|
+
}
|
|
51
|
+
const res = yield ctx.passkeyService.verifyPasskeyResponse(body.passkeyOptions, decoded.pk, cookiesValidationResult.decodedPasskeysCookies);
|
|
52
|
+
if (res.ok && res.passkeyConfirmed) {
|
|
53
|
+
verified = true;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
verificationError = (_b = res.error) !== null && _b !== void 0 ? _b : 'Invalid passkey';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const verificationResult = yield ctx.totpService.verifyUserCode(decoded.pk, body.code);
|
|
61
|
+
verified = 'ok' in verificationResult && verificationResult.ok;
|
|
62
|
+
if (!verified) {
|
|
63
|
+
verificationError = (_c = verificationResult.error) !== null && _c !== void 0 ? _c : verificationError;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (verified) {
|
|
67
|
+
ctx.cookieService.removeTotpTemporary(response);
|
|
68
|
+
ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
69
|
+
return { status: 'ok', allowedLogin: true };
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return { error: verificationError };
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
confirmLoginWithPasskey: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, cookies, headers, requestUrl, query }) {
|
|
76
|
+
var _b;
|
|
77
|
+
if (!ctx.options.passkeys || ctx.options.passkeys.allowLoginWithPasskeys === false) {
|
|
78
|
+
return { error: 'Login with passkeys is not allowed' };
|
|
79
|
+
}
|
|
80
|
+
const passkeyResponse = body.passkeyResponse;
|
|
81
|
+
if (!passkeyResponse) {
|
|
82
|
+
return { error: 'Passkey response is required' };
|
|
83
|
+
}
|
|
84
|
+
const passkeyLoginResult = yield ctx.passkeyService.getLoginUserByPasskeyResponse(passkeyResponse, cookies);
|
|
85
|
+
if (!passkeyLoginResult.ok) {
|
|
86
|
+
return { error: passkeyLoginResult.error };
|
|
87
|
+
}
|
|
88
|
+
const user = passkeyLoginResult.user;
|
|
89
|
+
const username = user[ctx.adminforth.config.auth.usernameField];
|
|
90
|
+
const userPk = user[ctx.userRepository.getUserPkField()];
|
|
91
|
+
const adminUser = {
|
|
92
|
+
dbUser: user,
|
|
93
|
+
pk: userPk,
|
|
94
|
+
username,
|
|
95
|
+
};
|
|
96
|
+
const toReturn = { allowedLogin: true, error: '' };
|
|
97
|
+
const rememberMe = (body === null || body === void 0 ? void 0 : body.rememberMe) || false;
|
|
98
|
+
const rememberDaysAfterPasskeyLogin = ctx.options.passkeys.rememberDaysAfterPasskeyLogin
|
|
99
|
+
? ctx.options.passkeys.rememberDaysAfterPasskeyLogin.toString().concat('d')
|
|
100
|
+
: null;
|
|
101
|
+
const expireInDuration = rememberMe
|
|
102
|
+
? ((_b = rememberDaysAfterPasskeyLogin !== null && rememberDaysAfterPasskeyLogin !== void 0 ? rememberDaysAfterPasskeyLogin : ctx.adminforth.config.auth.rememberMeDuration) !== null && _b !== void 0 ? _b : '30d')
|
|
103
|
+
: '1d';
|
|
104
|
+
yield ctx.adminforth.restApi.processLoginCallbacks(adminUser, toReturn, response, {
|
|
105
|
+
headers,
|
|
106
|
+
cookies,
|
|
107
|
+
requestUrl,
|
|
108
|
+
query,
|
|
109
|
+
body: {},
|
|
110
|
+
response,
|
|
111
|
+
meta: {
|
|
112
|
+
loginAllowedByPasskeyDirectSignIn: true
|
|
113
|
+
},
|
|
114
|
+
}, expireInDuration);
|
|
115
|
+
if (toReturn.allowedLogin === true) {
|
|
116
|
+
ctx.cookieService.setAuthCookie({
|
|
117
|
+
response,
|
|
118
|
+
username,
|
|
119
|
+
pk: userPk,
|
|
120
|
+
expireInDuration,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return toReturn;
|
|
124
|
+
}),
|
|
125
|
+
skipAllow: (_a) => __awaiter(this, [_a], void 0, function* ({ cookies }) {
|
|
126
|
+
const decoded = yield ctx.cookieService.verifyTotpTemporary(cookies);
|
|
127
|
+
if (!decoded) {
|
|
128
|
+
return { status: "error", message: "Invalid token" };
|
|
129
|
+
}
|
|
130
|
+
if (!decoded.newSecret) {
|
|
131
|
+
return { status: "ok", skipAllowed: false };
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return {
|
|
135
|
+
status: "ok",
|
|
136
|
+
skipAllowed: decoded.userCanSkipSetup,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
skipAllowModal: (_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, headers, cookies }) {
|
|
141
|
+
if (ctx.options.usersFilterToApply) {
|
|
142
|
+
const res = ctx.options.usersFilterToApply(adminUser);
|
|
143
|
+
if (res === false) {
|
|
144
|
+
return { skipAllowed: true };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (ctx.options.usersFilterToAllowSkipSetup) {
|
|
148
|
+
const res = yield ctx.checkIfSkipSetupAllowSkipVerify(adminUser);
|
|
149
|
+
if (res.skipAllowed === true) {
|
|
150
|
+
return { skipAllowed: true };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (ctx.options.stepUpMfaGracePeriodSeconds) {
|
|
154
|
+
const verificationResult = yield ctx.cookieService.isMfaGraceValid(headers, cookies, true);
|
|
155
|
+
if (verificationResult === true) {
|
|
156
|
+
return { skipAllowed: true };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { skipAllowed: false };
|
|
160
|
+
}),
|
|
161
|
+
verifyTotp: (_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, body }) {
|
|
162
|
+
if (!(body === null || body === void 0 ? void 0 : body.code))
|
|
163
|
+
return { error: 'Code is required' };
|
|
164
|
+
return ctx.totpService.verifyAdminUserCode(adminUser, body.code);
|
|
165
|
+
}),
|
|
166
|
+
};
|
|
167
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AdminForthPlugin } from "adminforth";
|
|
2
|
+
import type { AdminForthResource, AdminUser, IAdminForth, IHttpServer, IAdminForthAuth } from "adminforth";
|
|
3
|
+
import { PluginOptions } from "./types.js";
|
|
4
|
+
import { PasskeyService } from "./services/passkeyService.js";
|
|
5
|
+
import { TotpService } from "./services/totpService.js";
|
|
6
|
+
import { type MfaConfirmationResult, type VerifyOptions } from "./services/verifyMfaConfirmation.js";
|
|
7
|
+
import { CookieService } from "./services/cookieService.js";
|
|
8
|
+
import { UserRepository } from "./repositories/userRepository.js";
|
|
9
|
+
export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
10
|
+
options: PluginOptions;
|
|
11
|
+
adminforth: IAdminForth;
|
|
12
|
+
authResource: AdminForthResource;
|
|
13
|
+
adminForthAuth: IAdminForthAuth;
|
|
14
|
+
passkeyService: PasskeyService;
|
|
15
|
+
totpService: TotpService;
|
|
16
|
+
cookieService: CookieService;
|
|
17
|
+
userRepository: UserRepository;
|
|
18
|
+
private ctx;
|
|
19
|
+
constructor(options: PluginOptions);
|
|
20
|
+
instanceUniqueRepresentation(pluginOptions: any): string;
|
|
21
|
+
checkIfSkipSetupAllowSkipVerify(adminUser: AdminUser): Promise<{
|
|
22
|
+
skipAllowed: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
private pending;
|
|
25
|
+
private waitForResponse;
|
|
26
|
+
private resolveResponse;
|
|
27
|
+
verifyAuto(adminUser: AdminUser): Promise<any>;
|
|
28
|
+
verify(confirmationResult: MfaConfirmationResult, opts: VerifyOptions): Promise<{
|
|
29
|
+
ok: true;
|
|
30
|
+
} | {
|
|
31
|
+
error: string;
|
|
32
|
+
}>;
|
|
33
|
+
modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
|
|
34
|
+
validateConfigAfterDiscover(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
|
|
35
|
+
activate(resourceConfig: AdminForthResource, adminforth: IAdminForth): void;
|
|
36
|
+
setupEndpoints(server: IHttpServer): void;
|
|
37
|
+
}
|