@genesislcap/blank-app-seed 3.25.2 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.25.2",
4
+ "version": "3.26.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.26.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.25.2...v3.26.0) (2024-07-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * sso in angular [FUI-2069](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2069) (#282) 577c5a3
9
+
3
10
  ## [3.25.2](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.25.1...v3.25.2) (2024-07-23)
4
11
 
5
12
 
@@ -0,0 +1,41 @@
1
+ // Set the appHostURL from which the providers are to be fetched.
2
+ const appHostURL = `${location.protocol}//${location.host}/gwf/`;
3
+
4
+ const fetchIDPs = async () => {
5
+ const ipdsEndpoint = `${appHostURL}sso/list`;
6
+ console.log('IPD endpoint', ipdsEndpoint);
7
+ return fetch(ipdsEndpoint)
8
+ .then((res) => {
9
+ if (res.ok) return res;
10
+ throw new Error(res.statusText);
11
+ })
12
+ .then((res) => res.json())
13
+ .then((json) => json.IDPS)
14
+ .catch(() => {
15
+ console.error('Failed to fetch identity providers.');
16
+ return [{ ID: 'error', DESCRIPTION: 'Failed to fetch providers.' }];
17
+ });
18
+ };
19
+
20
+ // If we do not have initSSO token in our sessionStorage,
21
+ // then we check the list of providers and get ssoToken
22
+ if (!sessionStorage.getItem('initSSO')) {
23
+ fetchIDPs().then((allIdps) => {
24
+ console.log('Fetched IDPs', allIdps);
25
+ idps = allIdps.map((idp) => ({
26
+ id: idp.ID,
27
+ type: idp.TYPE,
28
+ }));
29
+
30
+ // Set initSSO token in sessionStorage after the first fetch of providers
31
+ sessionStorage.setItem('initSSO', 'true');
32
+
33
+ // If your environment has more providers and you want to test it - set a number corresponding to the number of your providers
34
+ if (idps.length === 1 && idps[0].type) {
35
+ const ssoLoginRoute = `/gwf/${idps[0].type}/login`;
36
+ const ssoLoginUrl = `${location.protocol}//${new URL(appHostURL).host}${ssoLoginRoute}?idp=${idps[0].id}`;
37
+
38
+ window.open(ssoLoginUrl, '_self');
39
+ }
40
+ });
41
+ }
@@ -6,6 +6,9 @@
6
6
  <base href="/">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
8
  <link rel="icon" type="image/x-icon" href="favicon.ico">
9
+ {{#if enableSSO}}
10
+ <script src="assets/initSSO.js"></script>
11
+ {{/if}}
9
12
  </head>
10
13
  <body>
11
14
  <{{rootElement}}></{{rootElement}}>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.25.2",
4
+ "version": "3.26.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"