@webiny/okta 0.0.0-unstable.6844005670 → 0.0.0-unstable.7be00a75a9
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/Okta.d.ts +1 -9
- package/Okta.js +37 -38
- package/Okta.js.map +1 -1
- package/admin/Extension.js +10 -11
- package/admin/Extension.js.map +1 -1
- package/admin/Okta.js +8 -14
- package/admin/Okta.js.map +1 -1
- package/admin/OktaLoginScreen.js +22 -30
- package/admin/OktaLoginScreen.js.map +1 -1
- package/admin/components/LoginContent.js +24 -32
- package/admin/components/LoginContent.js.map +1 -1
- package/admin/components/View.js +43 -66
- package/admin/components/View.js.map +1 -1
- package/admin/components/okta-icon.js +18 -0
- package/admin/components/okta-icon.js.map +1 -0
- package/admin/features/Okta/OktaPresenter.js +89 -105
- package/admin/features/Okta/OktaPresenter.js.map +1 -1
- package/admin/features/Okta/abstractions.js +2 -1
- package/admin/features/Okta/abstractions.js.map +1 -1
- package/admin/features/Okta/feature.js +12 -11
- package/admin/features/Okta/feature.js.map +1 -1
- package/admin/features/Okta/index.js +0 -2
- package/api/features/OktaIdp/OktaIIdentityProvider.js +28 -29
- package/api/features/OktaIdp/OktaIIdentityProvider.js.map +1 -1
- package/api/features/OktaIdp/abstractions.js +2 -1
- package/api/features/OktaIdp/abstractions.js.map +1 -1
- package/api/features/OktaIdp/feature.d.ts +4 -1
- package/api/features/OktaIdp/feature.js +6 -5
- package/api/features/OktaIdp/feature.js.map +1 -1
- package/api/features/OktaIdp/index.js +0 -2
- package/index.js +0 -2
- package/package.json +24 -20
- package/static/svg/okta-icon.038a9f65.svg +1 -0
- package/admin/features/Okta/index.js.map +0 -1
- package/api/features/OktaIdp/index.js.map +0 -1
- package/index.js.map +0 -1
package/Okta.d.ts
CHANGED
|
@@ -3,12 +3,4 @@ export declare const Okta: import("@webiny/project/defineExtension/defineExtensi
|
|
|
3
3
|
issuer: z.ZodString;
|
|
4
4
|
clientId: z.ZodString;
|
|
5
5
|
apiConfig: z.ZodString;
|
|
6
|
-
},
|
|
7
|
-
issuer: string;
|
|
8
|
-
clientId: string;
|
|
9
|
-
apiConfig: string;
|
|
10
|
-
}, {
|
|
11
|
-
issuer: string;
|
|
12
|
-
clientId: string;
|
|
13
|
-
apiConfig: string;
|
|
14
|
-
}>>;
|
|
6
|
+
}, z.core.$strip>>;
|
package/Okta.js
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
3
|
import { EnvVar } from "@webiny/project/extensions/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Admin, Api } from "@webiny/project-aws";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
6
|
+
const Okta = defineExtension({
|
|
7
|
+
type: "Project/Okta",
|
|
8
|
+
tags: {
|
|
9
|
+
runtimeContext: "project"
|
|
10
|
+
},
|
|
11
|
+
description: "Enable and configure Okta authentication.",
|
|
12
|
+
paramsSchema: z.object({
|
|
13
|
+
issuer: z.string().describe("Okta issuer URL."),
|
|
14
|
+
clientId: z.string().describe("Okta client ID."),
|
|
15
|
+
apiConfig: z.string().describe("Path to API configuration.")
|
|
16
|
+
}),
|
|
17
|
+
render: (props)=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(EnvVar, {
|
|
18
|
+
varName: "OKTA_ISSUER",
|
|
19
|
+
value: props.issuer
|
|
20
|
+
}), /*#__PURE__*/ react.createElement(EnvVar, {
|
|
21
|
+
varName: "OKTA_CLIENT_ID",
|
|
22
|
+
value: props.clientId
|
|
23
|
+
}), /*#__PURE__*/ react.createElement(EnvVar, {
|
|
24
|
+
varName: "REACT_APP_IDP_TYPE",
|
|
25
|
+
value: "okta"
|
|
26
|
+
}), /*#__PURE__*/ react.createElement(EnvVar, {
|
|
27
|
+
varName: "REACT_APP_OKTA_ISSUER",
|
|
28
|
+
value: props.issuer
|
|
29
|
+
}), /*#__PURE__*/ react.createElement(EnvVar, {
|
|
30
|
+
varName: "REACT_APP_OKTA_CLIENT_ID",
|
|
31
|
+
value: props.clientId
|
|
32
|
+
}), /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
33
|
+
src: import.meta.dirname + "/api/features/OktaIdp/feature.js",
|
|
34
|
+
exportName: "OktaIdpFeature"
|
|
35
|
+
}), /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
36
|
+
src: props.apiConfig
|
|
37
|
+
}), /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
38
|
+
src: import.meta.dirname + "/admin/Extension.js"
|
|
39
|
+
}))
|
|
42
40
|
});
|
|
41
|
+
export { Okta };
|
|
43
42
|
|
|
44
43
|
//# sourceMappingURL=Okta.js.map
|
package/Okta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Okta.js","sources":["../src/Okta.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\nimport { Api, Admin } from \"@webiny/project-aws\";\nimport { z } from \"zod\";\n\nexport const Okta = defineExtension({\n type: \"Project/Okta\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable and configure Okta authentication.\",\n paramsSchema: z.object({\n issuer: z.string().describe(\"Okta issuer URL.\"),\n clientId: z.string().describe(\"Okta client ID.\"),\n apiConfig: z.string().describe(\"Path to API configuration.\")\n }),\n render: props => {\n return (\n <>\n {/* Lambda vars */}\n <EnvVar varName={\"OKTA_ISSUER\"} value={props.issuer} />\n <EnvVar varName={\"OKTA_CLIENT_ID\"} value={props.clientId} />\n {/* Admin app vars */}\n <EnvVar varName={\"REACT_APP_IDP_TYPE\"} value={\"okta\"} />\n <EnvVar varName={\"REACT_APP_OKTA_ISSUER\"} value={props.issuer} />\n <EnvVar varName={\"REACT_APP_OKTA_CLIENT_ID\"} value={props.clientId} />\n {/* Api extensions */}\n <Api.Extension\n src={import.meta.dirname + \"/api/features/OktaIdp/feature.js\"}\n exportName={\"OktaIdpFeature\"}\n />\n <Api.Extension src={props.apiConfig} />\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n </>\n );\n }\n});\n"],"names":["Okta","defineExtension","z","props","EnvVar","Api","Admin"],"mappings":";;;;;AAMO,MAAMA,OAAOC,gBAAgB;IAChC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,QAAQA,EAAE,MAAM,GAAG,QAAQ,CAAC;QAC5B,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;QAC9B,WAAWA,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC;IACA,QAAQC,CAAAA,QACG,WAAP,GACI,wDAEI,oBAACC,QAAMA;YAAC,SAAS;YAAe,OAAOD,MAAM,MAAM;0BACnD,oBAACC,QAAMA;YAAC,SAAS;YAAkB,OAAOD,MAAM,QAAQ;0BAExD,oBAACC,QAAMA;YAAC,SAAS;YAAsB,OAAO;0BAC9C,oBAACA,QAAMA;YAAC,SAAS;YAAyB,OAAOD,MAAM,MAAM;0BAC7D,oBAACC,QAAMA;YAAC,SAAS;YAA4B,OAAOD,MAAM,QAAQ;0BAElE,oBAACE,IAAI,SAAS;YACV,KAAK,YAAY,OAAO,GAAG;YAC3B,YAAY;0BAEhB,oBAACA,IAAI,SAAS;YAAC,KAAKF,MAAM,SAAS;0BAEnC,oBAACG,MAAM,SAAS;YAAC,KAAK,YAAY,OAAO,GAAG;;AAI5D"}
|
package/admin/Extension.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { RegisterFeature } from "@webiny/app-admin/components/RegisterFeature.js";
|
|
3
3
|
import { Okta } from "./Okta.js";
|
|
4
4
|
import { OktaFeature } from "./features/Okta/feature.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
};
|
|
5
|
+
const Extension = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
6
|
+
feature: OktaFeature
|
|
7
|
+
}), /*#__PURE__*/ react.createElement(Okta, {
|
|
8
|
+
okta: {
|
|
9
|
+
issuer: String(process.env.REACT_APP_OKTA_ISSUER),
|
|
10
|
+
clientId: String(process.env.REACT_APP_OKTA_CLIENT_ID)
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
export { Extension };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=Extension.js.map
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin/components/RegisterFeature.js\";\nimport { Okta } from \"./Okta.js\";\nimport { OktaFeature } from \"./features/Okta/feature.js\";\n\nexport const Extension = () => {\n return (\n <>\n <RegisterFeature feature={OktaFeature} />\n <Okta\n okta={{\n issuer: String(process.env.REACT_APP_OKTA_ISSUER),\n clientId: String(process.env.REACT_APP_OKTA_CLIENT_ID)\n }}\n />\n </>\n );\n};\n"],"names":["Extension","RegisterFeature","OktaFeature","Okta","String","process"],"mappings":";;;;AAKO,MAAMA,YAAY,IACd,WAAP,GACI,wDACI,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACC,MAAIA;QACD,MAAM;YACF,QAAQC,OAAOC,QAAQ,GAAG,CAAC,qBAAqB;YAChD,UAAUD,OAAOC,QAAQ,GAAG,CAAC,wBAAwB;QACzD"}
|
package/admin/Okta.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Fragment } from "react";
|
|
1
|
+
import react, { Fragment } from "react";
|
|
3
2
|
import { LoginScreenRenderer } from "@webiny/app-admin";
|
|
4
3
|
import { OktaLoginScreen } from "./OktaLoginScreen.js";
|
|
5
|
-
const createLoginScreenPlugin = params
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
export const Okta = props => {
|
|
15
|
-
const LoginScreenPlugin = createLoginScreenPlugin(props);
|
|
16
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(LoginScreenPlugin, null));
|
|
4
|
+
const createLoginScreenPlugin = (params)=>LoginScreenRenderer.createDecorator(()=>function({ children }) {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(OktaLoginScreen, params, children);
|
|
6
|
+
});
|
|
7
|
+
const Okta_Okta = (props)=>{
|
|
8
|
+
const LoginScreenPlugin = createLoginScreenPlugin(props);
|
|
9
|
+
return /*#__PURE__*/ react.createElement(Fragment, null, /*#__PURE__*/ react.createElement(LoginScreenPlugin, null));
|
|
17
10
|
};
|
|
11
|
+
export { Okta_Okta as Okta };
|
|
18
12
|
|
|
19
13
|
//# sourceMappingURL=Okta.js.map
|
package/admin/Okta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/Okta.js","sources":["../../src/admin/Okta.tsx"],"sourcesContent":["import React from \"react\";\nimport { Fragment } from \"react\";\nimport { LoginScreenRenderer } from \"@webiny/app-admin\";\nimport { OktaLoginScreen } from \"./OktaLoginScreen.js\";\nimport type { CreateAuthenticationConfig } from \"./OktaLoginScreen.js\";\n\nconst createLoginScreenPlugin = (params: OktaProps) => {\n return LoginScreenRenderer.createDecorator(() => {\n return function Okta({ children }) {\n return <OktaLoginScreen {...params}>{children}</OktaLoginScreen>;\n };\n });\n};\n\nexport type OktaProps = Pick<CreateAuthenticationConfig, \"okta\"> & {\n children?: React.ReactNode;\n};\n\nexport const Okta = (props: OktaProps) => {\n const LoginScreenPlugin = createLoginScreenPlugin(props);\n return (\n <Fragment>\n <LoginScreenPlugin />\n </Fragment>\n );\n};\n"],"names":["createLoginScreenPlugin","params","LoginScreenRenderer","children","OktaLoginScreen","Okta","props","LoginScreenPlugin","Fragment"],"mappings":";;;AAMA,MAAMA,0BAA0B,CAACC,SACtBC,oBAAoB,eAAe,CAAC,IAChC,SAAc,EAAEC,QAAQ,EAAE;YAC7B,OAAO,WAAP,GAAO,oBAACC,iBAAoBH,QAASE;QACzC;AAQD,MAAME,YAAO,CAACC;IACjB,MAAMC,oBAAoBP,wBAAwBM;IAClD,OAAO,WAAP,GACI,oBAACE,UAAQA,MAAAA,WAAAA,GACL,oBAACD,mBAAAA;AAGb"}
|
package/admin/OktaLoginScreen.js
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useMemo } from "react";
|
|
1
|
+
import react, { useEffect, useMemo } from "react";
|
|
4
2
|
import { observer } from "mobx-react-lite";
|
|
5
3
|
import { useFeature } from "@webiny/app";
|
|
6
4
|
import { OktaFeature } from "./features/Okta/feature.js";
|
|
7
5
|
import { LoginContent } from "./components/LoginContent.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
const OktaLoginScreen = observer(({ okta, children })=>{
|
|
7
|
+
const { presenter } = useFeature(OktaFeature);
|
|
8
|
+
const autoLogin = useMemo(()=>{
|
|
9
|
+
const query = new URLSearchParams(window.location.search);
|
|
10
|
+
return "logout" !== query.get("action");
|
|
11
|
+
}, []);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
presenter.init({
|
|
14
|
+
issuer: okta.issuer,
|
|
15
|
+
clientId: okta.clientId,
|
|
16
|
+
autoLogin
|
|
17
|
+
});
|
|
18
|
+
}, []);
|
|
19
|
+
const vm = presenter.vm;
|
|
20
|
+
if (vm.isAuthenticated) return /*#__PURE__*/ react.createElement(react.Fragment, null, children);
|
|
21
|
+
return /*#__PURE__*/ react.createElement(LoginContent, {
|
|
22
|
+
onLogin: ()=>presenter.authenticate(),
|
|
23
|
+
checkingSession: vm.checkingSession,
|
|
24
|
+
isLoggingIn: vm.isLoggingIn,
|
|
25
|
+
isAuthenticated: vm.isAuthenticated
|
|
24
26
|
});
|
|
25
|
-
}, []);
|
|
26
|
-
const vm = presenter.vm;
|
|
27
|
-
if (vm.isAuthenticated) {
|
|
28
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
29
|
-
}
|
|
30
|
-
return /*#__PURE__*/React.createElement(LoginContent, {
|
|
31
|
-
onLogin: () => presenter.authenticate(),
|
|
32
|
-
checkingSession: vm.checkingSession,
|
|
33
|
-
isLoggingIn: vm.isLoggingIn,
|
|
34
|
-
isAuthenticated: vm.isAuthenticated
|
|
35
|
-
});
|
|
36
27
|
});
|
|
28
|
+
export { OktaLoginScreen };
|
|
37
29
|
|
|
38
30
|
//# sourceMappingURL=OktaLoginScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/OktaLoginScreen.js","sources":["../../src/admin/OktaLoginScreen.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect } from \"react\";\nimport { useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useFeature } from \"@webiny/app\";\nimport { OktaFeature } from \"~/admin/features/Okta/feature.js\";\nimport { LoginContent } from \"./components/LoginContent.js\";\n\nexport interface CreateAuthenticationConfig {\n okta: { issuer: string; clientId: string };\n children: React.ReactNode;\n}\n\nexport const OktaLoginScreen = observer(({ okta, children }: CreateAuthenticationConfig) => {\n const { presenter } = useFeature(OktaFeature);\n\n const autoLogin = useMemo(() => {\n const query = new URLSearchParams(window.location.search);\n return query.get(\"action\") !== \"logout\";\n }, []);\n\n useEffect(() => {\n presenter.init({\n issuer: okta.issuer,\n clientId: okta.clientId,\n autoLogin\n });\n }, []);\n\n const vm = presenter.vm;\n\n if (vm.isAuthenticated) {\n return <>{children}</>;\n }\n\n return (\n <LoginContent\n onLogin={() => presenter.authenticate()}\n checkingSession={vm.checkingSession}\n isLoggingIn={vm.isLoggingIn}\n isAuthenticated={vm.isAuthenticated}\n />\n );\n});\n"],"names":["OktaLoginScreen","observer","okta","children","presenter","useFeature","OktaFeature","autoLogin","useMemo","query","URLSearchParams","window","useEffect","vm","LoginContent"],"mappings":";;;;;AAaO,MAAMA,kBAAkBC,SAAS,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAA8B;IACnF,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IAEjC,MAAMC,YAAYC,QAAQ;QACtB,MAAMC,QAAQ,IAAIC,gBAAgBC,OAAO,QAAQ,CAAC,MAAM;QACxD,OAAOF,AAAwB,aAAxBA,MAAM,GAAG,CAAC;IACrB,GAAG,EAAE;IAELG,UAAU;QACNR,UAAU,IAAI,CAAC;YACX,QAAQF,KAAK,MAAM;YACnB,UAAUA,KAAK,QAAQ;YACvBK;QACJ;IACJ,GAAG,EAAE;IAEL,MAAMM,KAAKT,UAAU,EAAE;IAEvB,IAAIS,GAAG,eAAe,EAClB,OAAO,WAAP,GAAO,0CAAGV;IAGd,OAAO,WAAP,GACI,oBAACW,cAAYA;QACT,SAAS,IAAMV,UAAU,YAAY;QACrC,iBAAiBS,GAAG,eAAe;QACnC,aAAaA,GAAG,WAAW;QAC3B,iBAAiBA,GAAG,eAAe;;AAG/C"}
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { makeDecoratable } from "@webiny/app-admin";
|
|
3
|
-
import { Button } from "@webiny/admin-ui";
|
|
4
|
-
import {
|
|
5
|
-
import { OverlayLoader } from "@webiny/admin-ui";
|
|
6
|
-
import { ReactComponent as OktaIcon } from "./okta-icon.svg";
|
|
3
|
+
import { Button, Icon, OverlayLoader } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "./okta-icon.js";
|
|
7
5
|
import { View } from "./View.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
icon: /*#__PURE__*/React.createElement(OktaIcon, null),
|
|
30
|
-
label: "Okta"
|
|
31
|
-
}),
|
|
32
|
-
text: "Sign in with Okta"
|
|
33
|
-
})))) : null);
|
|
34
|
-
});
|
|
6
|
+
const LoginContent = makeDecoratable("LoginContent", ({ onLogin, isLoggingIn, checkingSession, isAuthenticated })=>/*#__PURE__*/ react.createElement(react.Fragment, null, isLoggingIn ? /*#__PURE__*/ react.createElement(OverlayLoader, {
|
|
7
|
+
text: "Logging in..."
|
|
8
|
+
}) : null, checkingSession ? /*#__PURE__*/ react.createElement(OverlayLoader, {
|
|
9
|
+
text: "Checking user session..."
|
|
10
|
+
}) : null, isAuthenticated || isLoggingIn || checkingSession ? null : /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(View.Title, {
|
|
11
|
+
title: "Sign In",
|
|
12
|
+
description: "You will be taken to Okta website to complete the sign in process."
|
|
13
|
+
}), /*#__PURE__*/ react.createElement("div", {
|
|
14
|
+
className: "flex w-full"
|
|
15
|
+
}, /*#__PURE__*/ react.createElement(Button, {
|
|
16
|
+
variant: "primary",
|
|
17
|
+
className: "w-full",
|
|
18
|
+
containerClassName: "w-full",
|
|
19
|
+
onClick: onLogin,
|
|
20
|
+
icon: /*#__PURE__*/ react.createElement(Icon, {
|
|
21
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
22
|
+
label: "Okta"
|
|
23
|
+
}),
|
|
24
|
+
text: "Sign in with Okta"
|
|
25
|
+
}))))));
|
|
26
|
+
export { LoginContent };
|
|
35
27
|
|
|
36
28
|
//# sourceMappingURL=LoginContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/components/LoginContent.js","sources":["../../../src/admin/components/LoginContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { Icon } from \"@webiny/admin-ui\";\nimport { OverlayLoader } from \"@webiny/admin-ui\";\nimport { ReactComponent as OktaIcon } from \"./okta-icon.svg\";\nimport { View } from \"./View.js\";\n\nexport interface LoginContentProps {\n isAuthenticated: boolean;\n isLoggingIn: boolean;\n checkingSession: boolean;\n onLogin: () => void;\n}\n\nexport const LoginContent = makeDecoratable(\n \"LoginContent\",\n ({ onLogin, isLoggingIn, checkingSession, isAuthenticated }: LoginContentProps) => {\n return (\n <>\n {isLoggingIn ? <OverlayLoader text={\"Logging in...\"} /> : null}\n {checkingSession ? <OverlayLoader text={\"Checking user session...\"} /> : null}\n {!isAuthenticated && !isLoggingIn && !checkingSession ? (\n <View.Container>\n <View.Content>\n <View.Title\n title={\"Sign In\"}\n description={\n \"You will be taken to Okta website to complete the sign in process.\"\n }\n />\n\n <div className={\"flex w-full\"}>\n <Button\n variant={\"primary\"}\n className={\"w-full\"}\n containerClassName={\"w-full\"}\n onClick={onLogin}\n icon={<Icon icon={<OktaIcon />} label={\"Okta\"} />}\n text={\"Sign in with Okta\"}\n />\n </div>\n </View.Content>\n </View.Container>\n ) : null}\n </>\n );\n }\n);\n"],"names":["LoginContent","makeDecoratable","onLogin","isLoggingIn","checkingSession","isAuthenticated","OverlayLoader","View","Button","Icon","OktaIcon"],"mappings":";;;;;AAeO,MAAMA,eAAeC,gBACxB,gBACA,CAAC,EAAEC,OAAO,EAAEC,WAAW,EAAEC,eAAe,EAAEC,eAAe,EAAqB,GACnE,WAAP,GACI,0CACKF,cAAc,WAAdA,GAAc,oBAACG,eAAaA;QAAC,MAAM;SAAsB,MACzDF,kBAAkB,WAAlBA,GAAkB,oBAACE,eAAaA;QAAC,MAAM;SAAiC,MACxE,AAACD,mBAAoBF,eAAgBC,kBAsBlC,OAtBoD,WAAlBA,GAClC,oBAACG,KAAK,SAAS,sBACX,oBAACA,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;QACP,OAAO;QACP,aACI;sBAIR,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QACH,SAAS;QACT,WAAW;QACX,oBAAoB;QACpB,SAASN;QACT,oBAAM,oBAACO,MAAIA;YAAC,oBAAM,oBAACC,gBAAQA;YAAK,OAAO;;QACvC,MAAM"}
|
package/admin/components/View.js
CHANGED
|
@@ -1,70 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}) => {
|
|
38
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
-
className: "mb-md"
|
|
40
|
-
}, /*#__PURE__*/React.createElement(Heading, {
|
|
41
|
-
level: 4
|
|
42
|
-
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
43
|
-
as: "div",
|
|
44
|
-
size: "sm",
|
|
45
|
-
className: "text-neutral-strong"
|
|
46
|
-
}, description));
|
|
47
|
-
});
|
|
48
|
-
export const Error = ({
|
|
49
|
-
title = "Something went wrong",
|
|
50
|
-
description
|
|
51
|
-
}) => {
|
|
52
|
-
if (!description) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
className: "mb-lg"
|
|
57
|
-
}, /*#__PURE__*/React.createElement(Alert, {
|
|
58
|
-
title: title,
|
|
59
|
-
type: "danger"
|
|
60
|
-
}, description));
|
|
1
|
+
import { Logo, makeDecoratable } from "@webiny/app-admin";
|
|
2
|
+
import { Alert, Grid, Heading, Text } from "@webiny/admin-ui";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
const Container = makeDecoratable("ViewContainer", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
5
|
+
className: "w-full h-screen bg-neutral-light flex-1"
|
|
6
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement("section", {
|
|
7
|
+
className: "m-auto flex flex-col justify-center min-h-screen"
|
|
8
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
9
|
+
className: "mx-auto"
|
|
10
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Logo, null)), /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
11
|
+
className: "w-full max-w-[480px] mx-auto my-lg"
|
|
12
|
+
}, children))));
|
|
13
|
+
const Content = makeDecoratable("ViewContent", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
14
|
+
className: "relative p-lg pt-md bg-neutral-base rounded-xl"
|
|
15
|
+
}, children));
|
|
16
|
+
const Footer = makeDecoratable("ViewFooter", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement(Grid, null, /*#__PURE__*/ __rspack_external_react.createElement(Grid.Column, {
|
|
17
|
+
span: 12,
|
|
18
|
+
className: "text-center mt-lg"
|
|
19
|
+
}, children)));
|
|
20
|
+
const Title = makeDecoratable("ViewTitle", ({ title, description })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
21
|
+
className: "mb-md"
|
|
22
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Heading, {
|
|
23
|
+
level: 4
|
|
24
|
+
}, title), description && /*#__PURE__*/ __rspack_external_react.createElement(Text, {
|
|
25
|
+
as: "div",
|
|
26
|
+
size: "sm",
|
|
27
|
+
className: "text-neutral-strong"
|
|
28
|
+
}, description)));
|
|
29
|
+
const Error = ({ title = "Something went wrong", description })=>{
|
|
30
|
+
if (!description) return null;
|
|
31
|
+
return /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
32
|
+
className: "mb-lg"
|
|
33
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Alert, {
|
|
34
|
+
title: title,
|
|
35
|
+
type: "danger"
|
|
36
|
+
}, description));
|
|
61
37
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
38
|
+
const View = {
|
|
39
|
+
Container: Container,
|
|
40
|
+
Content: Content,
|
|
41
|
+
Title: Title,
|
|
42
|
+
Footer: Footer,
|
|
43
|
+
Error: Error
|
|
68
44
|
};
|
|
45
|
+
export { Error, View };
|
|
69
46
|
|
|
70
47
|
//# sourceMappingURL=View.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/components/View.js","sources":["../../../src/admin/components/View.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo } from \"@webiny/app-admin\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Alert } from \"@webiny/admin-ui\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { Heading } from \"@webiny/admin-ui\";\nimport { Text } from \"@webiny/admin-ui\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nconst Container = makeDecoratable(\"ViewContainer\", ({ children }: ContainerProps) => {\n return (\n <div className={\"w-full h-screen bg-neutral-light flex-1\"}>\n <section className={\"m-auto flex flex-col justify-center min-h-screen\"}>\n <div className={\"mx-auto\"}>\n <Logo />\n </div>\n <div className={\"w-full max-w-[480px] mx-auto my-lg\"}>{children}</div>\n </section>\n </div>\n );\n});\n\nexport interface ContentProps {\n children: React.ReactNode;\n}\n\nconst Content = makeDecoratable(\"ViewContent\", ({ children }: ContentProps) => (\n <div className={\"relative p-lg pt-md bg-neutral-base rounded-xl\"}>{children}</div>\n));\n\nexport interface FooterProps {\n children: React.ReactNode;\n}\n\nconst Footer = makeDecoratable(\"ViewFooter\", ({ children }: FooterProps) => {\n return (\n <Grid>\n <Grid.Column span={12} className={\"text-center mt-lg\"}>\n {children}\n </Grid.Column>\n </Grid>\n );\n});\n\nexport interface TitleProps {\n title: string;\n description?: React.ReactNode;\n}\n\nconst Title = makeDecoratable(\"ViewTitle\", ({ title, description }: TitleProps) => {\n return (\n <div className={\"mb-md\"}>\n <Heading level={4}>{title}</Heading>\n {description && (\n <Text as={\"div\"} size={\"sm\"} className={\"text-neutral-strong\"}>\n {description}\n </Text>\n )}\n </div>\n );\n});\n\nexport interface ErrorProps {\n title?: string;\n description?: string | null;\n}\n\nexport const Error = ({ title = \"Something went wrong\", description }: ErrorProps) => {\n if (!description) {\n return null;\n }\n\n return (\n <div className={\"mb-lg\"}>\n <Alert title={title} type={\"danger\"}>\n {description}\n </Alert>\n </div>\n );\n};\n\nexport const View = {\n Container,\n Content,\n Title,\n Footer,\n Error\n};\n"],"names":["Container","makeDecoratable","children","Logo","Content","Footer","Grid","Title","title","description","Heading","Text","Error","Alert","View"],"mappings":";;;AAYA,MAAMA,YAAYC,gBAAgB,iBAAiB,CAAC,EAAEC,QAAQ,EAAkB,GACrE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAQ,WAAW;qBAChB,sCAAC;QAAI,WAAW;qBACZ,sCAACC,MAAIA,QAAAA,WAAAA,GAET,sCAAC;QAAI,WAAW;OAAuCD;AAUvE,MAAME,UAAUH,gBAAgB,eAAe,CAAC,EAAEC,QAAQ,EAAgB,iBACtE,sCAAC;QAAI,WAAW;OAAmDA;AAOvE,MAAMG,SAASJ,gBAAgB,cAAc,CAAC,EAAEC,QAAQ,EAAe,GAC5D,WAAP,GACI,sCAACI,MAAIA,MAAAA,WAAAA,GACD,sCAACA,KAAK,MAAM;QAAC,MAAM;QAAI,WAAW;OAC7BJ;AAWjB,MAAMK,QAAQN,gBAAgB,aAAa,CAAC,EAAEO,KAAK,EAAEC,WAAW,EAAc,GACnE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,SAAOA;QAAC,OAAO;OAAIF,QACnBC,eAAe,WAAfA,GACG,sCAACE,MAAIA;QAAC,IAAI;QAAO,MAAM;QAAM,WAAW;OACnCF;AAYd,MAAMG,QAAQ,CAAC,EAAEJ,QAAQ,sBAAsB,EAAEC,WAAW,EAAc;IAC7E,IAAI,CAACA,aACD,OAAO;IAGX,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACI,OAAKA;QAAC,OAAOL;QAAO,MAAM;OACtBC;AAIjB;AAEO,MAAMK,OAAO;IAChBd,WAAAA;IACAI,SAAAA;IACAG,OAAAA;IACAF,QAAAA;IACAO,OAAAA;AACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import __rslib_svgr_url__0__ from "../../static/svg/okta-icon.038a9f65.svg";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
const SvgOktaIcon = (props)=>/*#__PURE__*/ __rspack_external_react.createElement("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
strokeLinejoin: "round",
|
|
7
|
+
strokeMiterlimit: 2,
|
|
8
|
+
clipRule: "evenodd",
|
|
9
|
+
viewBox: "0 0 512 512",
|
|
10
|
+
...props
|
|
11
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement("path", {
|
|
12
|
+
d: "M281.086 9.305 270.8 136.057a129 129 0 0 0-14.732-.834c-6.254 0-12.37.417-18.346 1.39l-5.837-61.43c-.14-1.946 1.39-3.614 3.336-3.614h10.423l-5.003-62.125c-.14-1.946 1.39-3.614 3.196-3.614h34.051c1.946 0 3.475 1.668 3.197 3.614v-.14zm-85.892 6.254c-.556-1.807-2.501-2.919-4.308-2.224L158.92 25.01c-1.807.695-2.64 2.78-1.807 4.447l25.99 56.705-9.868 3.614c-1.807.695-2.64 2.78-1.807 4.447l26.546 55.732a119.2 119.2 0 0 1 30.993-11.813L195.333 15.559zM116.808 50.86l73.522 103.68c-9.312 6.116-17.79 13.343-25.017 21.682l-44.058-43.362c-1.39-1.39-1.25-3.614.14-4.865l8.06-6.671-43.78-44.336c-1.389-1.39-1.25-3.613.279-4.864l25.99-21.82c1.528-1.251 3.613-.973 4.725.556zM55.1 110.9c-1.53-1.112-3.753-.556-4.726 1.112l-16.956 29.464c-.973 1.668-.278 3.753 1.39 4.587l56.427 26.685-5.281 9.034c-.973 1.667-.278 3.891 1.529 4.586l56.149 25.712c4.03-10.424 9.45-20.153 16.122-28.909L55.1 110.902zm-41.556 80.054c.278-1.945 2.223-3.057 4.03-2.64l123 32.105c-3.197 10.424-5.003 21.403-5.281 32.8l-61.57-5.004a3.21 3.21 0 0 1-2.918-3.891l1.806-10.285-62.125-5.837c-1.946-.14-3.197-1.946-2.919-3.892l5.838-33.495.139.14zm-4.587 83.112c-1.946.14-3.196 1.946-2.918 3.892l5.976 33.495c.278 1.945 2.224 3.057 4.03 2.64l60.319-15.705 1.807 10.285c.278 1.946 2.223 3.058 4.03 2.64l59.485-16.4c-3.475-10.284-5.698-21.264-6.254-32.521L8.818 274.067h.14zm19.736 88.115c-.973-1.667-.278-3.752 1.39-4.586l114.8-54.481c4.308 10.284 10.145 19.874 17.094 28.491l-50.311 35.858c-1.53 1.112-3.753.695-4.726-.973l-5.281-9.173-51.285 35.44c-1.529 1.113-3.752.557-4.725-1.111l-17.095-29.465zm139.122-23.905-89.366 90.478c-1.39 1.39-1.251 3.614.278 4.865l26.128 21.82c1.53 1.25 3.614.973 4.726-.556l36.135-50.868 8.061 6.81c1.53 1.251 3.753.973 4.865-.694l35.024-50.868c-9.451-5.837-18.207-12.926-25.712-20.987zm-17.651 145.238c-1.807-.695-2.64-2.78-1.807-4.448l52.953-115.634c9.728 5.004 20.291 8.756 31.27 10.841l-15.565 59.763c-.417 1.806-2.502 2.918-4.309 2.223l-9.868-3.613-16.538 60.18c-.556 1.806-2.502 2.918-4.309 2.223l-31.966-11.674zm91.173-107.712-10.285 126.752c-.139 1.946 1.39 3.614 3.197 3.614h34.05c1.946 0 3.475-1.668 3.197-3.614l-5.003-62.125h10.423c1.946 0 3.475-1.668 3.336-3.614l-5.837-61.43c-5.977.973-12.092 1.39-18.346 1.39-5.003 0-9.868-.278-14.732-.973M363.92 32.653c.834-1.806 0-3.752-1.807-4.447l-31.966-11.674c-1.807-.695-3.753.417-4.309 2.224L309.3 78.936l-9.867-3.614c-1.807-.695-3.753.417-4.309 2.223l-15.566 59.763c11.119 2.224 21.542 5.976 31.271 10.84L363.92 32.655zm69.77 50.452-89.367 90.478a121.3 121.3 0 0 0-25.712-20.987l35.024-50.868c1.112-1.528 3.336-1.945 4.864-.695l8.061 6.81 36.136-50.867c1.112-1.529 3.336-1.807 4.725-.556l26.13 21.82c1.528 1.251 1.528 3.475.277 4.865h-.139zm48.365 71.159c1.807-.834 2.363-2.919 1.39-4.587l-17.095-29.464c-.973-1.668-3.196-2.085-4.725-1.112l-51.285 35.44-5.281-9.033c-.973-1.668-3.197-2.224-4.726-.973l-50.312 35.858c6.95 8.617 12.648 18.207 17.095 28.491l114.8-54.481zm18.068 46.142 5.837 33.495c.278 1.946-.972 3.614-2.918 3.892l-126.614 11.813c-.556-11.396-2.78-22.237-6.254-32.522l59.485-16.4c1.807-.556 3.752.695 4.03 2.64l1.807 10.286 60.319-15.705c1.806-.417 3.752.695 4.03 2.64zm-5.698 123c1.807.417 3.752-.695 4.03-2.64l5.838-33.495c.278-1.946-.973-3.614-2.919-3.892l-62.125-5.837 1.806-10.285c.278-1.946-.973-3.613-2.918-3.891l-61.57-5.004c-.278 11.397-2.085 22.376-5.281 32.8l123 32.105zm-32.8 76.44c-.973 1.669-3.197 2.086-4.726 1.113l-104.654-72.271c6.671-8.756 12.092-18.485 16.122-28.909l56.15 25.712c1.806.834 2.501 2.919 1.528 4.586l-5.281 9.034 56.427 26.685c1.668.834 2.363 2.919 1.39 4.586zM321.669 357.18l73.521 103.68c1.112 1.53 3.336 1.807 4.725.556l25.99-21.82c1.529-1.25 1.529-3.475.278-4.864l-43.78-44.336 8.062-6.671c1.528-1.251 1.528-3.475.139-4.865l-44.058-43.362c-7.366 8.339-15.705 15.705-25.017 21.681h.139zm-.695 141.207c-1.807.695-3.753-.417-4.308-2.224L283.032 373.58a119.2 119.2 0 0 0 30.993-11.813l26.546 55.732c.834 1.807 0 3.891-1.807 4.447l-9.868 3.614 25.99 56.705c.834 1.807 0 3.752-1.807 4.447l-31.966 11.675z"
|
|
13
|
+
}));
|
|
14
|
+
const okta_icon = __rslib_svgr_url__0__;
|
|
15
|
+
export default okta_icon;
|
|
16
|
+
export { SvgOktaIcon as ReactComponent };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=okta-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/components/okta-icon.js","sources":["../../../src/admin/components/okta-icon.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgOktaIcon = props => <svg xmlns=\"http://www.w3.org/2000/svg\" fillRule=\"evenodd\" strokeLinejoin=\"round\" strokeMiterlimit={2} clipRule=\"evenodd\" viewBox=\"0 0 512 512\" {...props}><path d=\"M281.086 9.305 270.8 136.057a129 129 0 0 0-14.732-.834c-6.254 0-12.37.417-18.346 1.39l-5.837-61.43c-.14-1.946 1.39-3.614 3.336-3.614h10.423l-5.003-62.125c-.14-1.946 1.39-3.614 3.196-3.614h34.051c1.946 0 3.475 1.668 3.197 3.614v-.14zm-85.892 6.254c-.556-1.807-2.501-2.919-4.308-2.224L158.92 25.01c-1.807.695-2.64 2.78-1.807 4.447l25.99 56.705-9.868 3.614c-1.807.695-2.64 2.78-1.807 4.447l26.546 55.732a119.2 119.2 0 0 1 30.993-11.813L195.333 15.559zM116.808 50.86l73.522 103.68c-9.312 6.116-17.79 13.343-25.017 21.682l-44.058-43.362c-1.39-1.39-1.25-3.614.14-4.865l8.06-6.671-43.78-44.336c-1.389-1.39-1.25-3.613.279-4.864l25.99-21.82c1.528-1.251 3.613-.973 4.725.556zM55.1 110.9c-1.53-1.112-3.753-.556-4.726 1.112l-16.956 29.464c-.973 1.668-.278 3.753 1.39 4.587l56.427 26.685-5.281 9.034c-.973 1.667-.278 3.891 1.529 4.586l56.149 25.712c4.03-10.424 9.45-20.153 16.122-28.909L55.1 110.902zm-41.556 80.054c.278-1.945 2.223-3.057 4.03-2.64l123 32.105c-3.197 10.424-5.003 21.403-5.281 32.8l-61.57-5.004a3.21 3.21 0 0 1-2.918-3.891l1.806-10.285-62.125-5.837c-1.946-.14-3.197-1.946-2.919-3.892l5.838-33.495.139.14zm-4.587 83.112c-1.946.14-3.196 1.946-2.918 3.892l5.976 33.495c.278 1.945 2.224 3.057 4.03 2.64l60.319-15.705 1.807 10.285c.278 1.946 2.223 3.058 4.03 2.64l59.485-16.4c-3.475-10.284-5.698-21.264-6.254-32.521L8.818 274.067h.14zm19.736 88.115c-.973-1.667-.278-3.752 1.39-4.586l114.8-54.481c4.308 10.284 10.145 19.874 17.094 28.491l-50.311 35.858c-1.53 1.112-3.753.695-4.726-.973l-5.281-9.173-51.285 35.44c-1.529 1.113-3.752.557-4.725-1.111l-17.095-29.465zm139.122-23.905-89.366 90.478c-1.39 1.39-1.251 3.614.278 4.865l26.128 21.82c1.53 1.25 3.614.973 4.726-.556l36.135-50.868 8.061 6.81c1.53 1.251 3.753.973 4.865-.694l35.024-50.868c-9.451-5.837-18.207-12.926-25.712-20.987zm-17.651 145.238c-1.807-.695-2.64-2.78-1.807-4.448l52.953-115.634c9.728 5.004 20.291 8.756 31.27 10.841l-15.565 59.763c-.417 1.806-2.502 2.918-4.309 2.223l-9.868-3.613-16.538 60.18c-.556 1.806-2.502 2.918-4.309 2.223l-31.966-11.674zm91.173-107.712-10.285 126.752c-.139 1.946 1.39 3.614 3.197 3.614h34.05c1.946 0 3.475-1.668 3.197-3.614l-5.003-62.125h10.423c1.946 0 3.475-1.668 3.336-3.614l-5.837-61.43c-5.977.973-12.092 1.39-18.346 1.39-5.003 0-9.868-.278-14.732-.973M363.92 32.653c.834-1.806 0-3.752-1.807-4.447l-31.966-11.674c-1.807-.695-3.753.417-4.309 2.224L309.3 78.936l-9.867-3.614c-1.807-.695-3.753.417-4.309 2.223l-15.566 59.763c11.119 2.224 21.542 5.976 31.271 10.84L363.92 32.655zm69.77 50.452-89.367 90.478a121.3 121.3 0 0 0-25.712-20.987l35.024-50.868c1.112-1.528 3.336-1.945 4.864-.695l8.061 6.81 36.136-50.867c1.112-1.529 3.336-1.807 4.725-.556l26.13 21.82c1.528 1.251 1.528 3.475.277 4.865h-.139zm48.365 71.159c1.807-.834 2.363-2.919 1.39-4.587l-17.095-29.464c-.973-1.668-3.196-2.085-4.725-1.112l-51.285 35.44-5.281-9.033c-.973-1.668-3.197-2.224-4.726-.973l-50.312 35.858c6.95 8.617 12.648 18.207 17.095 28.491l114.8-54.481zm18.068 46.142 5.837 33.495c.278 1.946-.972 3.614-2.918 3.892l-126.614 11.813c-.556-11.396-2.78-22.237-6.254-32.522l59.485-16.4c1.807-.556 3.752.695 4.03 2.64l1.807 10.286 60.319-15.705c1.806-.417 3.752.695 4.03 2.64zm-5.698 123c1.807.417 3.752-.695 4.03-2.64l5.838-33.495c.278-1.946-.973-3.614-2.919-3.892l-62.125-5.837 1.806-10.285c.278-1.946-.973-3.613-2.918-3.891l-61.57-5.004c-.278 11.397-2.085 22.376-5.281 32.8l123 32.105zm-32.8 76.44c-.973 1.669-3.197 2.086-4.726 1.113l-104.654-72.271c6.671-8.756 12.092-18.485 16.122-28.909l56.15 25.712c1.806.834 2.501 2.919 1.528 4.586l-5.281 9.034 56.427 26.685c1.668.834 2.363 2.919 1.39 4.586zM321.669 357.18l73.521 103.68c1.112 1.53 3.336 1.807 4.725.556l25.99-21.82c1.529-1.25 1.529-3.475.278-4.864l-43.78-44.336 8.062-6.671c1.528-1.251 1.528-3.475.139-4.865l-44.058-43.362c-7.366 8.339-15.705 15.705-25.017 21.681h.139zm-.695 141.207c-1.807.695-3.753-.417-4.308-2.224L283.032 373.58a119.2 119.2 0 0 0 30.993-11.813l26.546 55.732c.834 1.807 0 3.891-1.807 4.447l-9.868 3.614 25.99 56.705c.834 1.807 0 3.752-1.807 4.447l-31.966 11.675z\" /></svg>;\nexport { SvgOktaIcon as ReactComponent };\nexport default \"__RSLIB_SVGR_AUTO_PUBLIC_PATH__static/svg/okta-icon.038a9f65.svg\";"],"names":["SvgOktaIcon","props"],"mappings":";;AACA,MAAMA,cAAcC,CAAAA,QAAAA,WAAAA,GAAS,sCAAC;QAAI,OAAM;QAA6B,UAAS;QAAU,gBAAe;QAAQ,kBAAkB;QAAG,UAAS;QAAU,SAAQ;QAAe,GAAGA,KAAK;qBAAE,sCAAC;QAAK,GAAE;;AAEhM"}
|
|
@@ -1,119 +1,103 @@
|
|
|
1
|
-
import { makeAutoObservable } from "mobx";
|
|
2
|
-
import { runInAction } from "mobx";
|
|
1
|
+
import { makeAutoObservable, runInAction } from "mobx";
|
|
3
2
|
import { OktaAuth } from "@okta/okta-auth-js";
|
|
4
|
-
import { OktaPresenter
|
|
3
|
+
import { OktaPresenter } from "./abstractions.js";
|
|
5
4
|
import { LogInUseCase } from "@webiny/app-admin/features/security/LogIn";
|
|
6
5
|
import { IdentityContext } from "@webiny/app-admin/features/security/IdentityContext/index.js";
|
|
7
6
|
class OktaPresenterImpl {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Handle redirect callback if present
|
|
45
|
-
if (this.oktaAuth.token.isLoginRedirect()) {
|
|
46
|
-
runInAction(() => {
|
|
47
|
-
this.checkingSession = true;
|
|
48
|
-
});
|
|
49
|
-
try {
|
|
50
|
-
const {
|
|
51
|
-
tokens
|
|
52
|
-
} = await this.oktaAuth.token.parseFromUrl();
|
|
53
|
-
this.oktaAuth.tokenManager.setTokens(tokens);
|
|
54
|
-
// Clean up URL
|
|
55
|
-
window.history.replaceState({}, document.title, window.location.pathname);
|
|
56
|
-
} finally {
|
|
57
|
-
runInAction(() => {
|
|
58
|
-
this.checkingSession = false;
|
|
7
|
+
constructor(identity, loginUseCase){
|
|
8
|
+
this.identity = identity;
|
|
9
|
+
this.loginUseCase = loginUseCase;
|
|
10
|
+
this.loggingIn = false;
|
|
11
|
+
this.checkingSession = false;
|
|
12
|
+
makeAutoObservable(this);
|
|
13
|
+
}
|
|
14
|
+
get vm() {
|
|
15
|
+
const identity = this.identity.getIdentity();
|
|
16
|
+
return {
|
|
17
|
+
isAuthenticated: identity.isAuthenticated,
|
|
18
|
+
isLoggingIn: this.loggingIn,
|
|
19
|
+
checkingSession: this.checkingSession
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async init(params) {
|
|
23
|
+
this.oktaAuth = new OktaAuth({
|
|
24
|
+
issuer: params.issuer,
|
|
25
|
+
clientId: params.clientId,
|
|
26
|
+
redirectUri: window.location.origin,
|
|
27
|
+
scopes: [
|
|
28
|
+
"openid",
|
|
29
|
+
"profile",
|
|
30
|
+
"email",
|
|
31
|
+
"offline_access"
|
|
32
|
+
],
|
|
33
|
+
pkce: true,
|
|
34
|
+
tokenManager: {
|
|
35
|
+
storage: "localStorage"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
this.oktaAuth.authStateManager.subscribe((authState)=>{
|
|
39
|
+
if (authState.isAuthenticated && !this.identity.getIdentity().isAuthenticated) this.login();
|
|
59
40
|
});
|
|
60
|
-
|
|
41
|
+
if (this.oktaAuth.token.isLoginRedirect()) {
|
|
42
|
+
runInAction(()=>{
|
|
43
|
+
this.checkingSession = true;
|
|
44
|
+
});
|
|
45
|
+
try {
|
|
46
|
+
const { tokens } = await this.oktaAuth.token.parseFromUrl();
|
|
47
|
+
this.oktaAuth.tokenManager.setTokens(tokens);
|
|
48
|
+
window.history.replaceState({}, document.title, window.location.pathname);
|
|
49
|
+
} finally{
|
|
50
|
+
runInAction(()=>{
|
|
51
|
+
this.checkingSession = false;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
await this.oktaAuth.start();
|
|
56
|
+
if (!this.isOktaAuthenticated() && params.autoLogin) this.authenticate();
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// Only auto-login if not authenticated and autoLogin is enabled
|
|
67
|
-
if (!this.isOktaAuthenticated() && params.autoLogin) {
|
|
68
|
-
this.authenticate();
|
|
58
|
+
authenticate() {
|
|
59
|
+
this.getOktaAuth().signInWithRedirect({
|
|
60
|
+
originalUri: window.location.pathname + window.location.search
|
|
61
|
+
});
|
|
69
62
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
async login() {
|
|
64
|
+
if (this.loggingIn) return;
|
|
65
|
+
runInAction(()=>{
|
|
66
|
+
this.loggingIn = true;
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
const logoutCallback = async ()=>{
|
|
70
|
+
this.getOktaAuth().tokenManager.clear();
|
|
71
|
+
const url = new URL(`${window.location}`);
|
|
72
|
+
url.searchParams.set("action", "logout");
|
|
73
|
+
window.history.replaceState({}, "", url);
|
|
74
|
+
};
|
|
75
|
+
await this.loginUseCase.execute({
|
|
76
|
+
idTokenProvider: ()=>this.getOktaAuth().getIdToken(),
|
|
77
|
+
logoutCallback
|
|
78
|
+
});
|
|
79
|
+
} finally{
|
|
80
|
+
runInAction(()=>{
|
|
81
|
+
this.loggingIn = false;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
// Set logout callback
|
|
86
|
-
const logoutCallback = async () => {
|
|
87
|
-
// Clear tokens from local storage
|
|
88
|
-
this.getOktaAuth().tokenManager.clear();
|
|
89
|
-
const url = new URL(`${window.location}`);
|
|
90
|
-
url.searchParams.set("action", "logout");
|
|
91
|
-
window.history.replaceState({}, "", url);
|
|
92
|
-
};
|
|
93
|
-
await this.loginUseCase.execute({
|
|
94
|
-
idTokenProvider: () => this.getOktaAuth().getIdToken(),
|
|
95
|
-
logoutCallback
|
|
96
|
-
});
|
|
97
|
-
} finally {
|
|
98
|
-
runInAction(() => {
|
|
99
|
-
this.loggingIn = false;
|
|
100
|
-
});
|
|
85
|
+
getOktaAuth() {
|
|
86
|
+
if (!this.oktaAuth) throw new Error("OktaAuth is not initialized.");
|
|
87
|
+
return this.oktaAuth;
|
|
101
88
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
throw new Error("OktaAuth is not initialized.");
|
|
89
|
+
isOktaAuthenticated() {
|
|
90
|
+
const currentAuthState = this.getOktaAuth().authStateManager.getAuthState();
|
|
91
|
+
return currentAuthState?.isAuthenticated ?? false;
|
|
106
92
|
}
|
|
107
|
-
return this.oktaAuth;
|
|
108
|
-
}
|
|
109
|
-
isOktaAuthenticated() {
|
|
110
|
-
const currentAuthState = this.getOktaAuth().authStateManager.getAuthState();
|
|
111
|
-
return currentAuthState?.isAuthenticated ?? false;
|
|
112
|
-
}
|
|
113
93
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
94
|
+
const OktaPresenter_OktaPresenter = OktaPresenter.createImplementation({
|
|
95
|
+
implementation: OktaPresenterImpl,
|
|
96
|
+
dependencies: [
|
|
97
|
+
IdentityContext,
|
|
98
|
+
LogInUseCase
|
|
99
|
+
]
|
|
117
100
|
});
|
|
101
|
+
export { OktaPresenter_OktaPresenter as OktaPresenter };
|
|
118
102
|
|
|
119
103
|
//# sourceMappingURL=OktaPresenter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/features/Okta/OktaPresenter.js","sources":["../../../../src/admin/features/Okta/OktaPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { runInAction } from \"mobx\";\nimport { OktaAuth } from \"@okta/okta-auth-js\";\nimport type { AuthState } from \"@okta/okta-auth-js\";\nimport { OktaPresenter as Abstraction } from \"./abstractions.js\";\nimport { LogInUseCase } from \"@webiny/app-admin/features/security/LogIn\";\nimport { IdentityContext } from \"@webiny/app-admin/features/security/IdentityContext/index.js\";\n\nclass OktaPresenterImpl implements Abstraction.Interface {\n private oktaAuth: OktaAuth | undefined;\n private loggingIn = false;\n private checkingSession = false;\n\n constructor(\n private identity: IdentityContext.Interface,\n private loginUseCase: LogInUseCase.Interface\n ) {\n makeAutoObservable(this);\n }\n\n get vm() {\n const identity = this.identity.getIdentity();\n\n return {\n isAuthenticated: identity.isAuthenticated,\n isLoggingIn: this.loggingIn,\n checkingSession: this.checkingSession\n };\n }\n\n async init(params: Abstraction.InitParams): Promise<void> {\n this.oktaAuth = new OktaAuth({\n issuer: params.issuer,\n clientId: params.clientId,\n redirectUri: window.location.origin,\n scopes: [\"openid\", \"profile\", \"email\", \"offline_access\"],\n pkce: true,\n tokenManager: {\n storage: \"localStorage\"\n }\n });\n\n // Subscribe to authState changes\n this.oktaAuth.authStateManager.subscribe((authState: AuthState) => {\n // Handle authentication state changes\n if (authState.isAuthenticated && !this.identity.getIdentity().isAuthenticated) {\n // User just became authenticated, trigger login\n this.login();\n }\n });\n\n // Handle redirect callback if present\n if (this.oktaAuth.token.isLoginRedirect()) {\n runInAction(() => {\n this.checkingSession = true;\n });\n\n try {\n const { tokens } = await this.oktaAuth.token.parseFromUrl();\n this.oktaAuth.tokenManager.setTokens(tokens);\n // Clean up URL\n window.history.replaceState({}, document.title, window.location.pathname);\n } finally {\n runInAction(() => {\n this.checkingSession = false;\n });\n }\n }\n\n // Run as a service - this will trigger authStateManager updates\n await this.oktaAuth.start();\n\n // Only auto-login if not authenticated and autoLogin is enabled\n if (!this.isOktaAuthenticated() && params.autoLogin) {\n this.authenticate();\n }\n }\n\n authenticate() {\n this.getOktaAuth().signInWithRedirect({\n originalUri: window.location.pathname + window.location.search\n });\n }\n\n private async login(): Promise<void> {\n // Prevent duplicate login attempts\n if (this.loggingIn) {\n return;\n }\n\n runInAction(() => {\n this.loggingIn = true;\n });\n\n try {\n // Set logout callback\n const logoutCallback = async (): Promise<void> => {\n // Clear tokens from local storage\n this.getOktaAuth().tokenManager.clear();\n\n const url = new URL(`${window.location}`);\n url.searchParams.set(\"action\", \"logout\");\n window.history.replaceState({}, \"\", url);\n };\n\n await this.loginUseCase.execute({\n idTokenProvider: () => this.getOktaAuth().getIdToken(),\n logoutCallback\n });\n } finally {\n runInAction(() => {\n this.loggingIn = false;\n });\n }\n }\n\n private getOktaAuth() {\n if (!this.oktaAuth) {\n throw new Error(\"OktaAuth is not initialized.\");\n }\n return this.oktaAuth;\n }\n\n private isOktaAuthenticated() {\n const currentAuthState = this.getOktaAuth().authStateManager.getAuthState();\n return currentAuthState?.isAuthenticated ?? false;\n }\n}\n\nexport const OktaPresenter = Abstraction.createImplementation({\n implementation: OktaPresenterImpl,\n dependencies: [IdentityContext, LogInUseCase]\n});\n"],"names":["OktaPresenterImpl","identity","loginUseCase","makeAutoObservable","params","OktaAuth","window","authState","runInAction","tokens","document","logoutCallback","url","URL","Error","currentAuthState","OktaPresenter","Abstraction","IdentityContext","LogInUseCase"],"mappings":";;;;;AAQA,MAAMA;IAKF,YACYC,QAAmC,EACnCC,YAAoC,CAC9C;aAFUD,QAAQ,GAARA;aACAC,YAAY,GAAZA;aALJ,SAAS,GAAG;aACZ,eAAe,GAAG;QAMtBC,mBAAmB,IAAI;IAC3B;IAEA,IAAI,KAAK;QACL,MAAMF,WAAW,IAAI,CAAC,QAAQ,CAAC,WAAW;QAE1C,OAAO;YACH,iBAAiBA,SAAS,eAAe;YACzC,aAAa,IAAI,CAAC,SAAS;YAC3B,iBAAiB,IAAI,CAAC,eAAe;QACzC;IACJ;IAEA,MAAM,KAAKG,MAA8B,EAAiB;QACtD,IAAI,CAAC,QAAQ,GAAG,IAAIC,SAAS;YACzB,QAAQD,OAAO,MAAM;YACrB,UAAUA,OAAO,QAAQ;YACzB,aAAaE,OAAO,QAAQ,CAAC,MAAM;YACnC,QAAQ;gBAAC;gBAAU;gBAAW;gBAAS;aAAiB;YACxD,MAAM;YACN,cAAc;gBACV,SAAS;YACb;QACJ;QAGA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAACC;YAEtC,IAAIA,UAAU,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,eAAe,EAEzE,IAAI,CAAC,KAAK;QAElB;QAGA,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,IAAI;YACvCC,YAAY;gBACR,IAAI,CAAC,eAAe,GAAG;YAC3B;YAEA,IAAI;gBACA,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY;gBACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAACA;gBAErCH,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC,GAAGI,SAAS,KAAK,EAAEJ,OAAO,QAAQ,CAAC,QAAQ;YAC5E,SAAU;gBACNE,YAAY;oBACR,IAAI,CAAC,eAAe,GAAG;gBAC3B;YACJ;QACJ;QAGA,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK;QAGzB,IAAI,CAAC,IAAI,CAAC,mBAAmB,MAAMJ,OAAO,SAAS,EAC/C,IAAI,CAAC,YAAY;IAEzB;IAEA,eAAe;QACX,IAAI,CAAC,WAAW,GAAG,kBAAkB,CAAC;YAClC,aAAaE,OAAO,QAAQ,CAAC,QAAQ,GAAGA,OAAO,QAAQ,CAAC,MAAM;QAClE;IACJ;IAEA,MAAc,QAAuB;QAEjC,IAAI,IAAI,CAAC,SAAS,EACd;QAGJE,YAAY;YACR,IAAI,CAAC,SAAS,GAAG;QACrB;QAEA,IAAI;YAEA,MAAMG,iBAAiB;gBAEnB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,KAAK;gBAErC,MAAMC,MAAM,IAAIC,IAAI,GAAGP,OAAO,QAAQ,EAAE;gBACxCM,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU;gBAC/BN,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,IAAIM;YACxC;YAEA,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;gBAC5B,iBAAiB,IAAM,IAAI,CAAC,WAAW,GAAG,UAAU;gBACpDD;YACJ;QACJ,SAAU;YACNH,YAAY;gBACR,IAAI,CAAC,SAAS,GAAG;YACrB;QACJ;IACJ;IAEQ,cAAc;QAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EACd,MAAM,IAAIM,MAAM;QAEpB,OAAO,IAAI,CAAC,QAAQ;IACxB;IAEQ,sBAAsB;QAC1B,MAAMC,mBAAmB,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,YAAY;QACzE,OAAOA,kBAAkB,mBAAmB;IAChD;AACJ;AAEO,MAAMC,8BAAgBC,cAAAA,oBAAgC,CAAC;IAC1D,gBAAgBjB;IAChB,cAAc;QAACkB;QAAiBC;KAAa;AACjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/features/Okta/abstractions.js","sources":["../../../../src/admin/features/Okta/abstractions.ts"],"sourcesContent":["import { OktaAuth } from \"@okta/okta-auth-js\";\nimport { createAbstraction } from \"@webiny/feature/admin\";\n\nexport type IOnLogin = (oktaAuth: OktaAuth) => void;\n\nexport interface IOktaPresenter {\n vm: {\n isAuthenticated: boolean;\n isLoggingIn: boolean;\n checkingSession: boolean;\n };\n init(params: IOktaInitParams): Promise<void>;\n authenticate(): void;\n}\n\nexport interface IOktaInitParams {\n issuer: string;\n clientId: string;\n autoLogin: boolean;\n}\n\nexport const OktaPresenter = createAbstraction<IOktaPresenter>(\"OktaPresenter\");\n\nexport namespace OktaPresenter {\n export type Interface = IOktaPresenter;\n export type InitParams = IOktaInitParams;\n export type OnLogin = IOnLogin;\n}\n"],"names":["OktaPresenter","createAbstraction"],"mappings":";AAqBO,MAAMA,gBAAgBC,kBAAkC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/admin";
|
|
2
2
|
import { OktaPresenter } from "./OktaPresenter.js";
|
|
3
|
-
import { OktaPresenter as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { OktaPresenter as external_abstractions_js_OktaPresenter } from "./abstractions.js";
|
|
4
|
+
const OktaFeature = createFeature({
|
|
5
|
+
name: "Okta",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(OktaPresenter).inSingletonScope();
|
|
8
|
+
},
|
|
9
|
+
resolve (container) {
|
|
10
|
+
return {
|
|
11
|
+
presenter: container.resolve(external_abstractions_js_OktaPresenter)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
14
|
});
|
|
15
|
+
export { OktaFeature };
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/features/Okta/feature.js","sources":["../../../../src/admin/features/Okta/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { OktaPresenter } from \"./OktaPresenter.js\";\nimport { OktaPresenter as Presenter } from \"./abstractions.js\";\n\nexport const OktaFeature = createFeature({\n name: \"Okta\",\n register(container) {\n container.register(OktaPresenter).inSingletonScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(Presenter)\n };\n }\n});\n"],"names":["OktaFeature","createFeature","container","OktaPresenter","Presenter"],"mappings":";;;AAIO,MAAMA,cAAcC,cAAc;IACrC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,eAAe,gBAAgB;IACtD;IACA,SAAQD,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACE;QACjC;IACJ;AACJ"}
|
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import { OidcIdentityProvider } from "@webiny/api-core/idp";
|
|
2
2
|
import { OktaIdpConfig } from "./abstractions.js";
|
|
3
3
|
class OktaIdentityProviderImpl {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
isApplicable(token) {
|
|
10
|
-
const issuer = token.iss;
|
|
11
|
-
if (!issuer) {
|
|
12
|
-
return false;
|
|
4
|
+
constructor(config){
|
|
5
|
+
this.config = config;
|
|
6
|
+
this.issuer = String(process.env.OKTA_ISSUER);
|
|
7
|
+
this.clientId = String(process.env.OKTA_CLIENT_ID);
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
isApplicable(token) {
|
|
10
|
+
const issuer = token.iss;
|
|
11
|
+
if (!issuer) return false;
|
|
12
|
+
return new URL(issuer).hostname.endsWith(".okta.com") ?? false;
|
|
13
|
+
}
|
|
14
|
+
async getIdentity(jwt) {
|
|
15
|
+
const identity = await this.config.getIdentity(jwt);
|
|
16
|
+
return {
|
|
17
|
+
...identity,
|
|
18
|
+
type: "admin",
|
|
19
|
+
profile: {
|
|
20
|
+
...identity.profile,
|
|
21
|
+
external: true
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async verifyTokenClaims(token) {
|
|
26
|
+
if (this.config.verifyTokenClaims) await this.config.verifyTokenClaims(token);
|
|
30
27
|
}
|
|
31
|
-
}
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
const OktaIIdentityProvider = OidcIdentityProvider.createImplementation({
|
|
30
|
+
implementation: OktaIdentityProviderImpl,
|
|
31
|
+
dependencies: [
|
|
32
|
+
OktaIdpConfig
|
|
33
|
+
]
|
|
36
34
|
});
|
|
35
|
+
export { OktaIIdentityProvider };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=OktaIIdentityProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"api/features/OktaIdp/OktaIIdentityProvider.js","sources":["../../../../src/api/features/OktaIdp/OktaIIdentityProvider.ts"],"sourcesContent":["import { OidcIdentityProvider } from \"@webiny/api-core/idp\";\nimport { OktaIdpConfig } from \"./abstractions.js\";\n\nclass OktaIdentityProviderImpl implements OidcIdentityProvider.Interface {\n public issuer = String(process.env.OKTA_ISSUER);\n public clientId = String(process.env.OKTA_CLIENT_ID);\n\n constructor(private config: OktaIdpConfig.Interface) {}\n\n isApplicable(token: OidcIdentityProvider.JwtPayload) {\n const issuer = token.iss as string;\n if (!issuer) {\n return false;\n }\n\n return new URL(issuer).hostname.endsWith(\".okta.com\") ?? false;\n }\n\n async getIdentity(\n jwt: OidcIdentityProvider.JwtPayload\n ): Promise<OidcIdentityProvider.IdentityData> {\n const identity = await this.config.getIdentity(jwt);\n\n return {\n ...identity,\n type: \"admin\",\n profile: {\n ...identity.profile,\n external: true\n }\n };\n }\n\n async verifyTokenClaims(token: OidcIdentityProvider.JwtPayload): Promise<void> {\n if (this.config.verifyTokenClaims) {\n await this.config.verifyTokenClaims(token);\n }\n }\n}\n\nexport const OktaIIdentityProvider = OidcIdentityProvider.createImplementation({\n implementation: OktaIdentityProviderImpl,\n dependencies: [OktaIdpConfig]\n});\n"],"names":["OktaIdentityProviderImpl","config","String","process","token","issuer","URL","jwt","identity","OktaIIdentityProvider","OidcIdentityProvider","OktaIdpConfig"],"mappings":";;AAGA,MAAMA;IAIF,YAAoBC,MAA+B,CAAE;aAAjCA,MAAM,GAANA;aAHb,MAAM,GAAGC,OAAOC,QAAQ,GAAG,CAAC,WAAW;aACvC,QAAQ,GAAGD,OAAOC,QAAQ,GAAG,CAAC,cAAc;IAEG;IAEtD,aAAaC,KAAsC,EAAE;QACjD,MAAMC,SAASD,MAAM,GAAG;QACxB,IAAI,CAACC,QACD,OAAO;QAGX,OAAO,IAAIC,IAAID,QAAQ,QAAQ,CAAC,QAAQ,CAAC,gBAAgB;IAC7D;IAEA,MAAM,YACFE,GAAoC,EACM;QAC1C,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAACD;QAE/C,OAAO;YACH,GAAGC,QAAQ;YACX,MAAM;YACN,SAAS;gBACL,GAAGA,SAAS,OAAO;gBACnB,UAAU;YACd;QACJ;IACJ;IAEA,MAAM,kBAAkBJ,KAAsC,EAAiB;QAC3E,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAACA;IAE5C;AACJ;AAEO,MAAMK,wBAAwBC,qBAAqB,oBAAoB,CAAC;IAC3E,gBAAgBV;IAChB,cAAc;QAACW;KAAc;AACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"api/features/OktaIdp/abstractions.js","sources":["../../../../src/api/features/OktaIdp/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type jwt from \"jsonwebtoken\";\nimport type { IdentityData } from \"@webiny/api-core/idp\";\n\nexport type OktaIdentity = Omit<IdentityData, \"type\"> & {\n profile: Omit<IdentityData[\"profile\"], \"external\">;\n};\n\nexport interface IOktaIdpConfig {\n getIdentity(token: jwt.JwtPayload): Promise<OktaIdentity> | OktaIdentity;\n verifyTokenClaims?(token: jwt.JwtPayload): Promise<void> | void;\n}\n\nexport const OktaIdpConfig = createAbstraction<IOktaIdpConfig>(\"OktaIdpConfig\");\n\nexport namespace OktaIdpConfig {\n export type Interface = IOktaIdpConfig;\n export type IdentityData = OktaIdentity;\n export type JwtPayload = jwt.JwtPayload;\n}\n"],"names":["OktaIdpConfig","createAbstraction"],"mappings":";AAaO,MAAMA,gBAAgBC,kBAAkC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { OktaIIdentityProvider } from "./OktaIIdentityProvider.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const OktaIdpFeature = createFeature({
|
|
4
|
+
name: "OktaIdp",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(OktaIIdentityProvider).inSingletonScope();
|
|
7
|
+
}
|
|
8
8
|
});
|
|
9
|
+
export { OktaIdpFeature };
|
|
9
10
|
|
|
10
11
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"api/features/OktaIdp/feature.js","sources":["../../../../src/api/features/OktaIdp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { OktaIIdentityProvider } from \"./OktaIIdentityProvider.js\";\n\nexport const OktaIdpFeature = createFeature({\n name: \"OktaIdp\",\n register(container) {\n container.register(OktaIIdentityProvider).inSingletonScope();\n }\n});\n"],"names":["OktaIdpFeature","createFeature","container","OktaIIdentityProvider"],"mappings":";;AAGO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,uBAAuB,gBAAgB;IAC9D;AACJ"}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/okta",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.7be00a75a9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./*": "./*"
|
|
9
|
+
},
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|
|
9
12
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -12,31 +15,32 @@
|
|
|
12
15
|
"author": "Webiny Ltd.",
|
|
13
16
|
"license": "Webiny Enterprise",
|
|
14
17
|
"dependencies": {
|
|
15
|
-
"@okta/okta-auth-js": "7.14.
|
|
16
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
17
|
-
"@webiny/api-core": "0.0.0-unstable.
|
|
18
|
-
"@webiny/app": "0.0.0-unstable.
|
|
19
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
20
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
21
|
-
"@webiny/project": "0.0.0-unstable.
|
|
22
|
-
"@webiny/project-aws": "0.0.0-unstable.
|
|
18
|
+
"@okta/okta-auth-js": "7.14.2",
|
|
19
|
+
"@webiny/admin-ui": "0.0.0-unstable.7be00a75a9",
|
|
20
|
+
"@webiny/api-core": "0.0.0-unstable.7be00a75a9",
|
|
21
|
+
"@webiny/app": "0.0.0-unstable.7be00a75a9",
|
|
22
|
+
"@webiny/app-admin": "0.0.0-unstable.7be00a75a9",
|
|
23
|
+
"@webiny/feature": "0.0.0-unstable.7be00a75a9",
|
|
24
|
+
"@webiny/project": "0.0.0-unstable.7be00a75a9",
|
|
25
|
+
"@webiny/project-aws": "0.0.0-unstable.7be00a75a9",
|
|
23
26
|
"jsonwebtoken": "9.0.3",
|
|
24
|
-
"mobx": "6.15.
|
|
25
|
-
"mobx-react-lite": "
|
|
26
|
-
"react": "18.
|
|
27
|
-
"react-dom": "18.
|
|
28
|
-
"zod": "
|
|
27
|
+
"mobx": "6.15.3",
|
|
28
|
+
"mobx-react-lite": "4.1.1",
|
|
29
|
+
"react": "18.3.1",
|
|
30
|
+
"react-dom": "18.3.1",
|
|
31
|
+
"zod": "4.4.3"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@types/jsonwebtoken": "9.0.10",
|
|
32
35
|
"@types/jwk-to-pem": "2.0.3",
|
|
33
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
36
|
+
"@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
|
|
34
37
|
"rimraf": "6.1.3",
|
|
35
|
-
"typescript": "
|
|
38
|
+
"typescript": "6.0.3"
|
|
36
39
|
},
|
|
37
40
|
"publishConfig": {
|
|
38
|
-
"access": "public"
|
|
39
|
-
"directory": "dist"
|
|
41
|
+
"access": "public"
|
|
40
42
|
},
|
|
41
|
-
"
|
|
43
|
+
"webiny": {
|
|
44
|
+
"publishFrom": "dist"
|
|
45
|
+
}
|
|
42
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M281.086 9.305L270.8 136.057a129.037 129.037 0 00-14.732-.834c-6.254 0-12.37.417-18.346 1.39l-5.837-61.43c-.14-1.946 1.39-3.614 3.336-3.614h10.423l-5.003-62.125c-.14-1.946 1.39-3.614 3.196-3.614h34.051c1.946 0 3.475 1.668 3.197 3.614v-.14zm-85.892 6.254c-.556-1.807-2.501-2.919-4.308-2.224L158.92 25.01c-1.807.695-2.64 2.78-1.807 4.447l25.99 56.705-9.868 3.614c-1.807.695-2.64 2.78-1.807 4.447l26.546 55.732a119.16 119.16 0 0130.993-11.813L195.333 15.559h-.139zM116.808 50.86l73.522 103.68c-9.312 6.116-17.79 13.343-25.017 21.682l-44.058-43.362c-1.39-1.39-1.25-3.614.14-4.865l8.06-6.671-43.78-44.336c-1.389-1.39-1.25-3.613.279-4.864l25.99-21.82c1.528-1.251 3.613-.973 4.725.556h.139zM55.1 110.9c-1.53-1.112-3.753-.556-4.726 1.112l-16.956 29.464c-.973 1.668-.278 3.753 1.39 4.587l56.427 26.685-5.281 9.034c-.973 1.667-.278 3.891 1.529 4.586l56.149 25.712c4.03-10.424 9.45-20.153 16.122-28.909L55.1 110.902zm-41.556 80.054c.278-1.945 2.223-3.057 4.03-2.64l123 32.105c-3.197 10.424-5.003 21.403-5.281 32.8l-61.57-5.004a3.21 3.21 0 01-2.918-3.891l1.806-10.285-62.125-5.837c-1.946-.14-3.197-1.946-2.919-3.892l5.838-33.495.139.14zm-4.587 83.112c-1.946.14-3.196 1.946-2.918 3.892l5.976 33.495c.278 1.945 2.224 3.057 4.03 2.64l60.319-15.705 1.807 10.285c.278 1.946 2.223 3.058 4.03 2.64l59.485-16.4c-3.475-10.284-5.698-21.264-6.254-32.521L8.818 274.067h.14zm19.736 88.115c-.973-1.667-.278-3.752 1.39-4.586l114.8-54.481c4.308 10.284 10.145 19.874 17.094 28.491l-50.311 35.858c-1.53 1.112-3.753.695-4.726-.973l-5.281-9.173-51.285 35.44c-1.529 1.113-3.752.557-4.725-1.111l-17.095-29.465h.139zm139.122-23.905l-89.366 90.478c-1.39 1.39-1.251 3.614.278 4.865l26.128 21.82c1.53 1.25 3.614.973 4.726-.556l36.135-50.868 8.061 6.81c1.53 1.251 3.753.973 4.865-.694l35.024-50.868c-9.451-5.837-18.207-12.926-25.712-20.987h-.14zm-17.651 145.238c-1.807-.695-2.64-2.78-1.807-4.448l52.953-115.634c9.728 5.004 20.291 8.756 31.27 10.841l-15.565 59.763c-.417 1.806-2.502 2.918-4.309 2.223l-9.868-3.613-16.538 60.18c-.556 1.806-2.502 2.918-4.309 2.223l-31.966-11.674.139.139zm91.173-107.712l-10.285 126.752c-.139 1.946 1.39 3.614 3.197 3.614h34.05c1.946 0 3.475-1.668 3.197-3.614l-5.003-62.125h10.423c1.946 0 3.475-1.668 3.336-3.614l-5.837-61.43c-5.977.973-12.092 1.39-18.346 1.39-5.003 0-9.868-.278-14.732-.973zM363.92 32.653c.834-1.806 0-3.752-1.807-4.447l-31.966-11.674c-1.807-.695-3.753.417-4.309 2.224L309.3 78.936l-9.867-3.614c-1.807-.695-3.753.417-4.309 2.223l-15.566 59.763c11.119 2.224 21.542 5.976 31.271 10.84L363.92 32.655zm69.77 50.452l-89.367 90.478a121.31 121.31 0 00-25.712-20.987l35.024-50.868c1.112-1.528 3.336-1.945 4.864-.695l8.061 6.81 36.136-50.867c1.112-1.529 3.336-1.807 4.725-.556l26.13 21.82c1.528 1.251 1.528 3.475.277 4.865h-.139zm48.365 71.159c1.807-.834 2.363-2.919 1.39-4.587l-17.095-29.464c-.973-1.668-3.196-2.085-4.725-1.112l-51.285 35.44-5.281-9.033c-.973-1.668-3.197-2.224-4.726-.973l-50.312 35.858c6.95 8.617 12.648 18.207 17.095 28.491l114.8-54.481.14-.14zm18.068 46.142l5.837 33.495c.278 1.946-.972 3.614-2.918 3.892l-126.614 11.813c-.556-11.396-2.78-22.237-6.254-32.522l59.485-16.4c1.807-.556 3.752.695 4.03 2.64l1.807 10.286 60.319-15.705c1.806-.417 3.752.695 4.03 2.64l.278-.139zm-5.698 123c1.807.417 3.752-.695 4.03-2.64l5.838-33.495c.278-1.946-.973-3.614-2.919-3.892l-62.125-5.837 1.806-10.285c.278-1.946-.973-3.613-2.918-3.891l-61.57-5.004c-.278 11.397-2.085 22.376-5.281 32.8l123 32.105.139.14zm-32.8 76.44c-.973 1.669-3.197 2.086-4.726 1.113l-104.654-72.271c6.671-8.756 12.092-18.485 16.122-28.909l56.15 25.712c1.806.834 2.501 2.919 1.528 4.586l-5.281 9.034 56.427 26.685c1.668.834 2.363 2.919 1.39 4.586l-16.956 29.465zM321.669 357.18L395.19 460.86c1.112 1.53 3.336 1.807 4.725.556l25.99-21.82c1.529-1.25 1.529-3.475.278-4.864l-43.78-44.336 8.062-6.671c1.528-1.251 1.528-3.475.139-4.865l-44.058-43.362c-7.366 8.339-15.705 15.705-25.017 21.681h.139zm-.695 141.207c-1.807.695-3.753-.417-4.308-2.224L283.032 373.58a119.16 119.16 0 0030.993-11.813l26.546 55.732c.834 1.807 0 3.891-1.807 4.447l-9.868 3.614 25.99 56.705c.834 1.807 0 3.752-1.807 4.447l-31.966 11.675h-.139z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["OktaPresenter"],"sources":["index.ts"],"sourcesContent":["export { OktaPresenter } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["OktaIdpConfig"],"sources":["index.ts"],"sourcesContent":["export { OktaIdpConfig } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Okta","OktaIdpConfig"],"sources":["index.ts"],"sourcesContent":["export { Okta } from \"./Okta.js\";\nexport { OktaIdpConfig } from \"./api/features/OktaIdp/abstractions.js\";\n"],"mappings":"AAAA,SAASA,IAAI;AACb,SAASC,aAAa","ignoreList":[]}
|