@nibssplc/cams-sdk-react 0.0.1-beta.92 → 0.0.1-beta.94
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.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './components/ClientOnly';
|
|
|
7
7
|
export * from './components/UnifiedCAMSProvider';
|
|
8
8
|
export { default as MFAOptions } from './components/MFAOptions';
|
|
9
9
|
export { default as MFAGate } from './components/MFAGate';
|
|
10
|
-
export { default as
|
|
10
|
+
export { default as DefaultLoginPage } from './components/DefaultLoginPage';
|
|
11
11
|
export { default as ClientOnly } from './components/ClientOnly';
|
|
12
12
|
export { register, authenticate } from './components/CoreFIDO';
|
|
13
13
|
export { useCAMSContext } from './context/CAMSContext';
|
package/dist/index.esm.js
CHANGED
|
@@ -1850,7 +1850,7 @@ var MFAOptions = function (_a) {
|
|
|
1850
1850
|
_a.trys.push([0, 4, , 5]);
|
|
1851
1851
|
// 1. Fetch authentication challenge from your server
|
|
1852
1852
|
console.log("Requesting authentication challenge from server...");
|
|
1853
|
-
return [4 /*yield*/, axios.
|
|
1853
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge)];
|
|
1854
1854
|
case 1:
|
|
1855
1855
|
options = (_a.sent()).data;
|
|
1856
1856
|
console.log("Received challenge:", options);
|
|
@@ -1862,7 +1862,7 @@ var MFAOptions = function (_a) {
|
|
|
1862
1862
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1863
1863
|
// 3. Send the assertion back to the server for verification
|
|
1864
1864
|
console.log("Sending assertion to server for verification...");
|
|
1865
|
-
return [4 /*yield*/, axios.post(
|
|
1865
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.AuthChallengeVerify, assertionResponse)];
|
|
1866
1866
|
case 3:
|
|
1867
1867
|
_a.sent();
|
|
1868
1868
|
toast.success("🔑 Sign-in successful!");
|
|
@@ -2054,7 +2054,7 @@ var ADLoginModal = function (_a) {
|
|
|
2054
2054
|
};
|
|
2055
2055
|
|
|
2056
2056
|
var DefaultLoginPage = function (_a) {
|
|
2057
|
-
var usePassKey = _a.usePassKey, MFAEndpoints = _a.MFAEndpoints;
|
|
2057
|
+
var usePassKey = _a.usePassKey, MFAEndpoints = _a.MFAEndpoints, PassKeysRegisterProps = _a.PassKeysRegisterProps;
|
|
2058
2058
|
var context = useCAMSContext();
|
|
2059
2059
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2060
2060
|
var _b = useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
@@ -2078,7 +2078,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2078
2078
|
},
|
|
2079
2079
|
exit: { opacity: 0, scale: 0.8, y: -50, transition: { duration: 0.3 } },
|
|
2080
2080
|
};
|
|
2081
|
-
var handleRegister = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2081
|
+
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2082
2082
|
var options, attestationResponse, error_1;
|
|
2083
2083
|
return __generator(this, function (_a) {
|
|
2084
2084
|
switch (_a.label) {
|
|
@@ -2086,7 +2086,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2086
2086
|
_a.trys.push([0, 4, , 5]);
|
|
2087
2087
|
// 1. Fetch challenge from your server
|
|
2088
2088
|
console.log("Requesting registration challenge from server...");
|
|
2089
|
-
return [4 /*yield*/, axios.
|
|
2089
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RegisterNewChallenge, __assign({}, data))];
|
|
2090
2090
|
case 1:
|
|
2091
2091
|
options = (_a.sent()).data;
|
|
2092
2092
|
console.log("Received challenge:", options);
|
|
@@ -2119,7 +2119,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2119
2119
|
// variant="outline"
|
|
2120
2120
|
, {
|
|
2121
2121
|
// variant="outline"
|
|
2122
|
-
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" })] }), 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(KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: isLoading ? "Logging in..." : "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: handleRegister, disabled: isLoading, children: [jsxRuntimeExports.jsx(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(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) {
|
|
2122
|
+
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" })] }), 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(KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: isLoading ? "Logging in..." : "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(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(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) {
|
|
2123
2123
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2124
2124
|
return __generator(this, function (_c) {
|
|
2125
2125
|
// Implement your AD login logic here
|
|
@@ -2146,7 +2146,7 @@ var MFAGate = function (_a) {
|
|
|
2146
2146
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2147
2147
|
_c = _a.usePassKey,
|
|
2148
2148
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2149
|
-
usePassKey = _c === void 0 ? false : _c, MFAEndpoints = _a.MFAEndpoints;
|
|
2149
|
+
usePassKey = _c === void 0 ? false : _c, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints;
|
|
2150
2150
|
var context = useCAMSContext();
|
|
2151
2151
|
var validatedMFAEndpoints = useMemo(function () {
|
|
2152
2152
|
var parsed = MFAEndpointsSchema.safeParse(MFAEndpoints);
|
|
@@ -2181,10 +2181,10 @@ var MFAGate = function (_a) {
|
|
|
2181
2181
|
return (jsxRuntimeExports.jsx(MFAOptions, { MFAEndpoints: validatedMFAEndpoints, usePassKey: usePassKey, onComplete: handleComplete, onAuthFailed: handleAuthFailed }));
|
|
2182
2182
|
}
|
|
2183
2183
|
if (!context.isAuthenticated) {
|
|
2184
|
-
return jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, MFAEndpoints: MFAEndpoints });
|
|
2184
|
+
return (jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, MFAEndpoints: MFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps }));
|
|
2185
2185
|
}
|
|
2186
2186
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2187
2187
|
};
|
|
2188
2188
|
|
|
2189
|
-
export { CAMSMSALProvider, CAMSProvider, ClientOnly, DefaultLoginPage
|
|
2189
|
+
export { CAMSMSALProvider, CAMSProvider, ClientOnly, DefaultLoginPage, MFAGate, MFAOptions, ProtectedRoute, UnifiedCAMSProvider, authenticate, register, useCAMSAuth, useCAMSContext, useCAMSMSALAuth, useCAMSMSALContext, useWebAuthn };
|
|
2190
2190
|
//# sourceMappingURL=index.esm.js.map
|