@nibssplc/cams-sdk-react 0.0.1-beta.103 → 0.0.1-beta.105
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/dist/components/DefaultLoginPage.d.ts +3 -1
- package/dist/components/MFAGate.d.ts +3 -1
- package/dist/hooks/useOTPHandler.d.ts +1 -1
- package/dist/index.cjs.js +120 -30
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +120 -30
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { MFAEndpoints } from "./MFAGate";
|
|
2
2
|
interface LoginPageProps {
|
|
3
3
|
usePassKey?: boolean;
|
|
4
|
+
CredentialsAuthEndpoint?: string;
|
|
5
|
+
useADLogin?: boolean;
|
|
4
6
|
MFAEndpoints: MFAEndpoints;
|
|
5
7
|
PassKeysRegisterProps?: Record<string, unknown>;
|
|
6
8
|
}
|
|
7
|
-
declare const DefaultLoginPage: ({ usePassKey, MFAEndpoints, PassKeysRegisterProps, }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const DefaultLoginPage: ({ usePassKey, useADLogin, MFAEndpoints, CredentialsAuthEndpoint, PassKeysRegisterProps, }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export default DefaultLoginPage;
|
|
@@ -11,8 +11,10 @@ interface MFAGateProps {
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
fallback?: React.ReactNode;
|
|
13
13
|
usePassKey?: boolean;
|
|
14
|
+
useADLogin?: boolean;
|
|
15
|
+
CredentialsAuthEndpoint?: string;
|
|
14
16
|
PassKeysRegisterProps?: Record<string, unknown>;
|
|
15
17
|
MFAEndpoints?: MFAEndpoints;
|
|
16
18
|
}
|
|
17
|
-
declare const MFAGate: ({ children, fallback, usePassKey, PassKeysRegisterProps, MFAEndpoints, }: MFAGateProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
+
declare const MFAGate: ({ children, fallback, usePassKey, useADLogin, CredentialsAuthEndpoint, PassKeysRegisterProps, MFAEndpoints, }: MFAGateProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
18
20
|
export default MFAGate;
|
|
@@ -15,7 +15,7 @@ export declare const useOTPHandler: ({ provider, accessToken, idToken, appCode,
|
|
|
15
15
|
resetAttempts: () => void;
|
|
16
16
|
remainingAttempts: number;
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const CredentialsHandler: (credentials: Credentials, appCode: string, CredAuthEndpoint: string, onAuthComplete: (state: boolean, data: UserValidatedResponse | null) => void) => {
|
|
19
19
|
handleSubmitCredentials: ({ username, password, MFACode, appCode, }: {
|
|
20
20
|
username: string;
|
|
21
21
|
password: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1869,6 +1869,81 @@ var useOTPHandler = function (_a) {
|
|
|
1869
1869
|
remainingAttempts: MAX_ATTEMPTS - attemptCount,
|
|
1870
1870
|
};
|
|
1871
1871
|
};
|
|
1872
|
+
var CredentialsHandler = function (credentials, appCode, CredAuthEndpoint, onAuthComplete) {
|
|
1873
|
+
var _a = React.useState(false), loading = _a[0], setLoading = _a[1];
|
|
1874
|
+
var _b = React.useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
|
|
1875
|
+
var _c = React.useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
|
|
1876
|
+
var handleSubmitCredentials = React.useMemo(function () {
|
|
1877
|
+
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
1878
|
+
var currentAttempt, response, error_2, currentAttempt;
|
|
1879
|
+
var username = _b.username, password = _b.password, MFACode = _b.MFACode, appCode = _b.appCode;
|
|
1880
|
+
return __generator(this, function (_c) {
|
|
1881
|
+
switch (_c.label) {
|
|
1882
|
+
case 0:
|
|
1883
|
+
_c.trys.push([0, 2, 3, 4]);
|
|
1884
|
+
setLoading(true);
|
|
1885
|
+
currentAttempt = attemptCount + 1;
|
|
1886
|
+
setAttemptCount(currentAttempt);
|
|
1887
|
+
return [4 /*yield*/, axios.post(CredAuthEndpoint, {
|
|
1888
|
+
username: username,
|
|
1889
|
+
password: password,
|
|
1890
|
+
MFACode: MFACode,
|
|
1891
|
+
appCode: appCode,
|
|
1892
|
+
}, {
|
|
1893
|
+
headers: {
|
|
1894
|
+
"X-Device-ID": GenerateDeviceId(),
|
|
1895
|
+
},
|
|
1896
|
+
timeout: 605000,
|
|
1897
|
+
})];
|
|
1898
|
+
case 1:
|
|
1899
|
+
response = (_c.sent()).data;
|
|
1900
|
+
if (response) {
|
|
1901
|
+
onAuthComplete(true, response);
|
|
1902
|
+
return [2 /*return*/, true];
|
|
1903
|
+
}
|
|
1904
|
+
else {
|
|
1905
|
+
if (currentAttempt >= MAX_ATTEMPTS) {
|
|
1906
|
+
setIsMaxAttemptsReached(true);
|
|
1907
|
+
onAuthComplete(false, {
|
|
1908
|
+
message: "Maximum attempts reached",
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
else {
|
|
1912
|
+
onAuthComplete(false, response.response.data);
|
|
1913
|
+
}
|
|
1914
|
+
return [2 /*return*/, false];
|
|
1915
|
+
}
|
|
1916
|
+
case 2:
|
|
1917
|
+
error_2 = _c.sent();
|
|
1918
|
+
console.error(error_2);
|
|
1919
|
+
currentAttempt = attemptCount + 1;
|
|
1920
|
+
if (currentAttempt >= MAX_ATTEMPTS) {
|
|
1921
|
+
setIsMaxAttemptsReached(true);
|
|
1922
|
+
onAuthComplete(false, error_2.response.data);
|
|
1923
|
+
}
|
|
1924
|
+
else {
|
|
1925
|
+
onAuthComplete(false, error_2.response.data);
|
|
1926
|
+
}
|
|
1927
|
+
onAuthComplete(false, error_2.response.data);
|
|
1928
|
+
return [2 /*return*/, false];
|
|
1929
|
+
case 3:
|
|
1930
|
+
setLoading(false);
|
|
1931
|
+
return [7 /*endfinally*/];
|
|
1932
|
+
case 4: return [2 /*return*/];
|
|
1933
|
+
}
|
|
1934
|
+
});
|
|
1935
|
+
}); };
|
|
1936
|
+
}, [credentials.username, credentials.password, credentials.MFACode]);
|
|
1937
|
+
return {
|
|
1938
|
+
handleSubmitCredentials: handleSubmitCredentials,
|
|
1939
|
+
loading: loading,
|
|
1940
|
+
setLoading: setLoading,
|
|
1941
|
+
attemptCount: attemptCount,
|
|
1942
|
+
isMaxAttemptsReached: isMaxAttemptsReached,
|
|
1943
|
+
// resetAttempts,
|
|
1944
|
+
remainingAttempts: MAX_ATTEMPTS - attemptCount,
|
|
1945
|
+
};
|
|
1946
|
+
};
|
|
1872
1947
|
|
|
1873
1948
|
var MFAOptions = function (_a) {
|
|
1874
1949
|
var onComplete = _a.onComplete, onAuthFailed = _a.onAuthFailed, MFAEndpoints = _a.MFAEndpoints, usePassKey = _a.usePassKey;
|
|
@@ -1887,11 +1962,10 @@ var MFAOptions = function (_a) {
|
|
|
1887
1962
|
var authenticate = useWebAuthn().authenticate;
|
|
1888
1963
|
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1889
1964
|
var options, assertionResponse, error_1;
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
switch (_g.label) {
|
|
1965
|
+
return __generator(this, function (_a) {
|
|
1966
|
+
switch (_a.label) {
|
|
1893
1967
|
case 0:
|
|
1894
|
-
|
|
1968
|
+
_a.trys.push([0, 4, , 5]);
|
|
1895
1969
|
// 1. Fetch authentication challenge from your server
|
|
1896
1970
|
console.log("Requesting authentication challenge from server...");
|
|
1897
1971
|
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
|
|
@@ -1901,16 +1975,13 @@ var MFAOptions = function (_a) {
|
|
|
1901
1975
|
},
|
|
1902
1976
|
})];
|
|
1903
1977
|
case 1:
|
|
1904
|
-
options = (
|
|
1978
|
+
options = (_a.sent()).data;
|
|
1905
1979
|
console.log("Received challenge:", options);
|
|
1906
1980
|
// 2. Call the SDK to trigger the browser's passkey authentication UI
|
|
1907
1981
|
console.log("Calling SDK authenticate function...");
|
|
1908
|
-
return [4 /*yield*/, authenticate(__assign(__assign({}, options), {
|
|
1909
|
-
type: "public-key",
|
|
1910
|
-
alg: param.alg
|
|
1911
|
-
}); }), attestation: ((_b = options.attestation) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || "none", authenticatorSelection: __assign(__assign({}, options.authenticatorSelection), { residentKey: ((_d = (_c = options.authenticatorSelection) === null || _c === void 0 ? void 0 : _c.residentKey) === null || _d === void 0 ? void 0 : _d.toLowerCase()) || "discouraged", userVerification: ((_f = (_e = options.authenticatorSelection) === null || _e === void 0 ? void 0 : _e.userVerification) === null || _f === void 0 ? void 0 : _f.toLowerCase()) || "preferred" }) }))];
|
|
1982
|
+
return [4 /*yield*/, authenticate(__assign(__assign({}, options), { userVerification: "discouraged" }))];
|
|
1912
1983
|
case 2:
|
|
1913
|
-
assertionResponse =
|
|
1984
|
+
assertionResponse = _a.sent();
|
|
1914
1985
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1915
1986
|
// 3. Send the assertion back to the server for verification
|
|
1916
1987
|
console.log("Sending assertion to server for verification...");
|
|
@@ -1922,11 +1993,11 @@ var MFAOptions = function (_a) {
|
|
|
1922
1993
|
withCredentials: true, // credentials: 'include'
|
|
1923
1994
|
})];
|
|
1924
1995
|
case 3:
|
|
1925
|
-
|
|
1996
|
+
_a.sent();
|
|
1926
1997
|
sonner.toast.success("🔑 Sign-in successful!");
|
|
1927
1998
|
return [3 /*break*/, 5];
|
|
1928
1999
|
case 4:
|
|
1929
|
-
error_1 =
|
|
2000
|
+
error_1 = _a.sent();
|
|
1930
2001
|
console.error("Authentication failed:", error_1);
|
|
1931
2002
|
sonner.toast.error("❌ Could not sign in.");
|
|
1932
2003
|
return [3 /*break*/, 5];
|
|
@@ -2102,17 +2173,27 @@ var ADLoginModal = function (_a) {
|
|
|
2102
2173
|
form.reset();
|
|
2103
2174
|
setMfaCode("");
|
|
2104
2175
|
};
|
|
2105
|
-
return (jsxRuntimeExports.jsx(Dialog, { open: open, onOpenChange: handleClose, children: jsxRuntimeExports.jsxs(DialogContent, { className: "sm:max-w-[
|
|
2176
|
+
return (jsxRuntimeExports.jsx(Dialog, { open: open, onOpenChange: handleClose, children: jsxRuntimeExports.jsxs(DialogContent, { className: "sm:max-w-[75%] max-w-[400px]", children: [jsxRuntimeExports.jsx(DialogHeader, { children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsxRuntimeExports.jsx(DialogTitle, { className: "text-2xl", children: "Sign in with AD" })] }) }), step === "credentials" ? (jsxRuntimeExports.jsx(Form, __assign({}, form, { children: jsxRuntimeExports.jsxs("form", { onSubmit: form.handleSubmit(handleCredentialsSubmit), className: "space-y-4", children: [jsxRuntimeExports.jsx(FormField, { control: form.control, name: "username", render: function (_a) {
|
|
2106
2177
|
var field = _a.field;
|
|
2107
|
-
return (jsxRuntimeExports.jsxs(FormItem, { children: [jsxRuntimeExports.jsx(FormLabel, { children: "Username" }), jsxRuntimeExports.jsx(FormControl, { children: jsxRuntimeExports.jsx(Input, __assign({ placeholder: "Enter your username" }, field)) }), jsxRuntimeExports.jsx(FormMessage, {})] }));
|
|
2178
|
+
return (jsxRuntimeExports.jsxs(FormItem, { children: [jsxRuntimeExports.jsx(FormLabel, { children: "Username" }), jsxRuntimeExports.jsx(FormControl, { children: jsxRuntimeExports.jsx(Input, __assign({ className: "h-12", placeholder: "Enter your username" }, field)) }), jsxRuntimeExports.jsx(FormMessage, {})] }));
|
|
2108
2179
|
} }), jsxRuntimeExports.jsx(FormField, { control: form.control, name: "password", render: function (_a) {
|
|
2109
2180
|
var field = _a.field;
|
|
2110
|
-
return (jsxRuntimeExports.jsxs(FormItem, { children: [jsxRuntimeExports.jsx(FormLabel, { children: "Password" }), jsxRuntimeExports.jsx(FormControl, { children: jsxRuntimeExports.jsx(Input, __assign({ type: "password", placeholder: "Enter your password" }, field)) }), jsxRuntimeExports.jsx(FormMessage, {})] }));
|
|
2181
|
+
return (jsxRuntimeExports.jsxs(FormItem, { children: [jsxRuntimeExports.jsx(FormLabel, { children: "Password" }), jsxRuntimeExports.jsx(FormControl, { children: jsxRuntimeExports.jsx(Input, __assign({ className: "h-12", type: "password", placeholder: "Enter your password" }, field)) }), jsxRuntimeExports.jsx(FormMessage, {})] }));
|
|
2111
2182
|
} }), jsxRuntimeExports.jsx(Button, { type: "submit", className: "w-full bg-[#506f4a] hover:bg-[#506f4a]/90", children: "Continue" })] }) }))) : (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx(GenericOTPVerifier, { value: mfaCode, setValue: setMfaCode, setLoading: setIsLoading, isDisabled: isLoading, onChangeOTP: handleMFASubmit, fieldName: "AuthenticatorCode" }), isLoading && (jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }), jsxRuntimeExports.jsx("span", { children: "Verifying..." })] }))] }))] }) }));
|
|
2112
2183
|
};
|
|
2113
2184
|
|
|
2114
2185
|
var DefaultLoginPage = function (_a) {
|
|
2115
|
-
var usePassKey = _a.usePassKey, MFAEndpoints = _a.MFAEndpoints, PassKeysRegisterProps = _a.PassKeysRegisterProps;
|
|
2186
|
+
var usePassKey = _a.usePassKey, useADLogin = _a.useADLogin, MFAEndpoints = _a.MFAEndpoints, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps;
|
|
2187
|
+
var cardVariants = {
|
|
2188
|
+
hidden: { opacity: 0, scale: 0.8, y: 50 },
|
|
2189
|
+
visible: {
|
|
2190
|
+
opacity: 1,
|
|
2191
|
+
scale: 1,
|
|
2192
|
+
y: 0,
|
|
2193
|
+
transition: { type: "spring", duration: 0.6 },
|
|
2194
|
+
},
|
|
2195
|
+
exit: { opacity: 0, scale: 0.8, y: -50, transition: { duration: 0.3 } },
|
|
2196
|
+
};
|
|
2116
2197
|
var context = useCAMSContext();
|
|
2117
2198
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2118
2199
|
var _b = React.useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
@@ -2126,16 +2207,6 @@ var DefaultLoginPage = function (_a) {
|
|
|
2126
2207
|
console.warn("Regular CAMS login requires configuration");
|
|
2127
2208
|
}
|
|
2128
2209
|
};
|
|
2129
|
-
var cardVariants = {
|
|
2130
|
-
hidden: { opacity: 0, scale: 0.8, y: 50 },
|
|
2131
|
-
visible: {
|
|
2132
|
-
opacity: 1,
|
|
2133
|
-
scale: 1,
|
|
2134
|
-
y: 0,
|
|
2135
|
-
transition: { type: "spring", duration: 0.6 },
|
|
2136
|
-
},
|
|
2137
|
-
exit: { opacity: 0, scale: 0.8, y: -50, transition: { duration: 0.3 } },
|
|
2138
|
-
};
|
|
2139
2210
|
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2140
2211
|
var options, attestationResponse, error_1;
|
|
2141
2212
|
return __generator(this, function (_a) {
|
|
@@ -2185,11 +2256,28 @@ var DefaultLoginPage = function (_a) {
|
|
|
2185
2256
|
// variant="outline"
|
|
2186
2257
|
, {
|
|
2187
2258
|
// variant="outline"
|
|
2188
|
-
className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: handleMSALLogin, disabled: isLoading, children: [jsxRuntimeExports.jsx("img", { src: MicrosoftLogo, alt: "Microsoft Logo", width: 35, height: 35 }), jsxRuntimeExports.jsx("span", { className: "ml-2", children: isLoading ? "Logging in..." : "Sign in with Microsoft" })] }),
|
|
2259
|
+
className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: handleMSALLogin, disabled: isLoading, children: [jsxRuntimeExports.jsx("img", { src: MicrosoftLogo, alt: "Microsoft Logo", width: 35, height: 35 }), jsxRuntimeExports.jsx("span", { className: "ml-2", children: isLoading ? "Logging in..." : "Sign in with Microsoft" })] }), useADLogin && (jsxRuntimeExports.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () { return setShowADModal(true); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-24 h-24 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: isLoading
|
|
2260
|
+
? "Logging in..."
|
|
2261
|
+
: "Sign in with ActiveDirectory" })] })), usePassKey && (jsxRuntimeExports.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () { return handleRegister(PassKeysRegisterProps); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-12 h-12 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntimeExports.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntimeExports.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntimeExports.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntimeExports.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, onLogin: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
2189
2262
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2190
2263
|
return __generator(this, function (_c) {
|
|
2191
2264
|
// Implement your AD login logic here
|
|
2192
2265
|
console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
|
|
2266
|
+
// Example: await adLoginService(username, password, mfaCode);
|
|
2267
|
+
CredentialsHandler({ username: username, password: password, MFACode: MFACode }, context.appCode, CredentialsAuthEndpoint !== null && CredentialsAuthEndpoint !== void 0 ? CredentialsAuthEndpoint : "/api/auth/validate", function (state, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2268
|
+
return __generator(this, function (_a) {
|
|
2269
|
+
console.log(data);
|
|
2270
|
+
if (state && data) {
|
|
2271
|
+
context.isAuthenticated = true;
|
|
2272
|
+
context.requiresMFA = false;
|
|
2273
|
+
context.setUserProfile({
|
|
2274
|
+
type: "AUTH_SUCCESS",
|
|
2275
|
+
userProfile: __assign({}, data),
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
return [2 /*return*/];
|
|
2279
|
+
});
|
|
2280
|
+
}); });
|
|
2193
2281
|
return [2 /*return*/];
|
|
2194
2282
|
});
|
|
2195
2283
|
}); } })] }));
|
|
@@ -2212,7 +2300,7 @@ var MFAGate = function (_a) {
|
|
|
2212
2300
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2213
2301
|
_c = _a.usePassKey,
|
|
2214
2302
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2215
|
-
usePassKey = _c === void 0 ? false : _c, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints;
|
|
2303
|
+
usePassKey = _c === void 0 ? false : _c, _d = _a.useADLogin, useADLogin = _d === void 0 ? false : _d, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints;
|
|
2216
2304
|
var context = useCAMSContext();
|
|
2217
2305
|
var validatedMFAEndpoints = React.useMemo(function () {
|
|
2218
2306
|
var parsed = MFAEndpointsSchema.safeParse(MFAEndpoints);
|
|
@@ -2237,8 +2325,10 @@ var MFAGate = function (_a) {
|
|
|
2237
2325
|
});
|
|
2238
2326
|
}); }, [context.logout]);
|
|
2239
2327
|
camsSdk.Logger.debug("MFA Endpoint >>>", { MFAEndpoints: MFAEndpoints });
|
|
2328
|
+
if (useADLogin && !CredentialsAuthEndpoint)
|
|
2329
|
+
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid AD Login Configuration." });
|
|
2240
2330
|
if (!validatedMFAEndpoints)
|
|
2241
|
-
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA
|
|
2331
|
+
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA Configuration." });
|
|
2242
2332
|
if (context.authMode !== "MSAL")
|
|
2243
2333
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2244
2334
|
if (context.isLoading)
|
|
@@ -2247,7 +2337,7 @@ var MFAGate = function (_a) {
|
|
|
2247
2337
|
return (jsxRuntimeExports.jsx(MFAOptions, { MFAEndpoints: validatedMFAEndpoints, usePassKey: usePassKey, onComplete: handleComplete, onAuthFailed: handleAuthFailed }));
|
|
2248
2338
|
}
|
|
2249
2339
|
if (!context.isAuthenticated) {
|
|
2250
|
-
return (jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, MFAEndpoints: MFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps }));
|
|
2340
|
+
return (jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, useADLogin: useADLogin, MFAEndpoints: MFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps, CredentialsAuthEndpoint: CredentialsAuthEndpoint }));
|
|
2251
2341
|
}
|
|
2252
2342
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2253
2343
|
};
|