@nibssplc/cams-sdk-react 0.0.1-beta.104 → 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/index.cjs.js +11 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -13
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1941,11 +1941,10 @@ var MFAOptions = function (_a) {
|
|
|
1941
1941
|
var authenticate = useWebAuthn().authenticate;
|
|
1942
1942
|
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1943
1943
|
var options, assertionResponse, error_1;
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
switch (_g.label) {
|
|
1944
|
+
return __generator(this, function (_a) {
|
|
1945
|
+
switch (_a.label) {
|
|
1947
1946
|
case 0:
|
|
1948
|
-
|
|
1947
|
+
_a.trys.push([0, 4, , 5]);
|
|
1949
1948
|
// 1. Fetch authentication challenge from your server
|
|
1950
1949
|
console.log("Requesting authentication challenge from server...");
|
|
1951
1950
|
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
|
|
@@ -1955,16 +1954,13 @@ var MFAOptions = function (_a) {
|
|
|
1955
1954
|
},
|
|
1956
1955
|
})];
|
|
1957
1956
|
case 1:
|
|
1958
|
-
options = (
|
|
1957
|
+
options = (_a.sent()).data;
|
|
1959
1958
|
console.log("Received challenge:", options);
|
|
1960
1959
|
// 2. Call the SDK to trigger the browser's passkey authentication UI
|
|
1961
1960
|
console.log("Calling SDK authenticate function...");
|
|
1962
|
-
return [4 /*yield*/, authenticate(__assign(__assign({}, options), {
|
|
1963
|
-
type: "public-key",
|
|
1964
|
-
alg: param.alg
|
|
1965
|
-
}); }), 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" }) }))];
|
|
1961
|
+
return [4 /*yield*/, authenticate(__assign(__assign({}, options), { userVerification: "discouraged" }))];
|
|
1966
1962
|
case 2:
|
|
1967
|
-
assertionResponse =
|
|
1963
|
+
assertionResponse = _a.sent();
|
|
1968
1964
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1969
1965
|
// 3. Send the assertion back to the server for verification
|
|
1970
1966
|
console.log("Sending assertion to server for verification...");
|
|
@@ -1976,11 +1972,11 @@ var MFAOptions = function (_a) {
|
|
|
1976
1972
|
withCredentials: true, // credentials: 'include'
|
|
1977
1973
|
})];
|
|
1978
1974
|
case 3:
|
|
1979
|
-
|
|
1975
|
+
_a.sent();
|
|
1980
1976
|
toast.success("🔑 Sign-in successful!");
|
|
1981
1977
|
return [3 /*break*/, 5];
|
|
1982
1978
|
case 4:
|
|
1983
|
-
error_1 =
|
|
1979
|
+
error_1 = _a.sent();
|
|
1984
1980
|
console.error("Authentication failed:", error_1);
|
|
1985
1981
|
toast.error("❌ Could not sign in.");
|
|
1986
1982
|
return [3 /*break*/, 5];
|
|
@@ -2308,8 +2304,10 @@ var MFAGate = function (_a) {
|
|
|
2308
2304
|
});
|
|
2309
2305
|
}); }, [context.logout]);
|
|
2310
2306
|
Logger.debug("MFA Endpoint >>>", { MFAEndpoints: MFAEndpoints });
|
|
2307
|
+
if (useADLogin && !CredentialsAuthEndpoint)
|
|
2308
|
+
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid AD Login Configuration." });
|
|
2311
2309
|
if (!validatedMFAEndpoints)
|
|
2312
|
-
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA
|
|
2310
|
+
return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA Configuration." });
|
|
2313
2311
|
if (context.authMode !== "MSAL")
|
|
2314
2312
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2315
2313
|
if (context.isLoading)
|