@geogirafe/lib-geoportal 1.0.2135490622 → 1.0.2136269476

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geomapfish.dev"
7
7
  },
8
- "version": "1.0.2135490622",
8
+ "version": "1.0.2136269476",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -1 +1 @@
1
- {"version":"1.0.2135490622", "build":"2135490622", "date":"02/11/2025"}
1
+ {"version":"1.0.2136269476", "build":"2136269476", "date":"03/11/2025"}
@@ -2,6 +2,7 @@ import AbstractConnectManager from './abstractconnectmanager';
2
2
  export default class OpenIdConnectManager extends AbstractConnectManager {
3
3
  private authorizationServer?;
4
4
  private silentLoginIframe?;
5
+ private sendTimeoutErrorCallbackTimeoutId;
5
6
  private get issuerConfig();
6
7
  private authProcessed;
7
8
  private isAuthentified;
@@ -3,6 +3,7 @@ import { authorizationCodeGrantRequest, calculatePKCECodeChallenge, discoveryReq
3
3
  export default class OpenIdConnectManager extends AbstractConnectManager {
4
4
  authorizationServer;
5
5
  silentLoginIframe;
6
+ sendTimeoutErrorCallbackTimeoutId = -1;
6
7
  get issuerConfig() {
7
8
  return this.context.configManager.Config.oauth.issuer;
8
9
  }
@@ -127,6 +128,9 @@ export default class OpenIdConnectManager extends AbstractConnectManager {
127
128
  this.silentLoginIframe.style.display = 'none';
128
129
  this.silentLoginIframe.src = authorizationUrl.toString();
129
130
  document.body.appendChild(this.silentLoginIframe);
131
+ this.sendTimeoutErrorCallbackTimeoutId = window.setTimeout(() => {
132
+ window.postMessage({ type: 'OAUTH_ERROR', error: `Timeout: Looks like we did not get any Response within 5s` }, window.location.origin);
133
+ }, 5000);
130
134
  }
131
135
  async handleSilentLoggedInViaIframe(event) {
132
136
  if (event.data?.type === 'OAUTH_CALLBACK') {
@@ -143,9 +147,12 @@ export default class OpenIdConnectManager extends AbstractConnectManager {
143
147
  this.state.oauth.status = 'loggedOut';
144
148
  }
145
149
  if (this.silentLoginIframe) {
146
- document.body.removeChild(this.silentLoginIframe);
150
+ this.silentLoginIframe.remove();
147
151
  this.silentLoginIframe = undefined;
148
152
  }
153
+ if (this.sendTimeoutErrorCallbackTimeoutId > -1) {
154
+ window.clearTimeout(this.sendTimeoutErrorCallbackTimeoutId);
155
+ }
149
156
  }
150
157
  async redirectToIssuerLogin() {
151
158
  const authorizationUrl = await this.getAuthorizationUrl(false);
@@ -21,16 +21,16 @@ class ThemesManager extends GirafeSingleton {
21
21
  }
22
22
  initializeSingleton() {
23
23
  // We have to wait the authentication to be able to load the themes with the right user-rights
24
- this.context.stateManager.subscribe('application.isAuthInitialized', () => {
24
+ this.context.stateManager.subscribe('application.isAuthInitialized', async () => {
25
25
  if (this.state.application.isAuthInitialized) {
26
- this.initialize();
26
+ await this.initialize();
27
27
  }
28
28
  });
29
29
  // This is for the next change in the oAuth status.
30
- this.context.stateManager.subscribe('oauth.status', () => {
30
+ this.context.stateManager.subscribe('oauth.status', async () => {
31
31
  if (this.state.themes.isLoaded &&
32
32
  (this.state.oauth.status === 'loggedIn' || this.state.oauth.status === 'loggedOut')) {
33
- this.initialize();
33
+ await this.initialize();
34
34
  }
35
35
  });
36
36
  }