@opengeoweb/authentication 9.35.1-spike-oltanstack.0 → 9.37.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.
package/index.esm.js
CHANGED
|
@@ -4,12 +4,13 @@ import React__default, { useRef } from 'react';
|
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import { Navigate, Link } from 'react-router-dom';
|
|
6
6
|
import { useIsMounted, SHARED_NAMESPACE, AlertBanner, useDebounce } from '@opengeoweb/shared';
|
|
7
|
+
import { snackbarReducer, snackbarListener, snackbarTypes, snackbarActions } from '@opengeoweb/snackbar';
|
|
8
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
7
9
|
import { ThemeWrapper } from '@opengeoweb/theme';
|
|
8
10
|
import { useTranslation, Trans } from 'react-i18next';
|
|
9
11
|
import 'i18next';
|
|
10
12
|
import { Box, LinearProgress, FormGroup, FormLabel, FormControlLabel, Radio } from '@mui/material';
|
|
11
13
|
import { useDispatch } from 'react-redux';
|
|
12
|
-
import { snackbarTypes, snackbarActions } from '@opengeoweb/snackbar';
|
|
13
14
|
|
|
14
15
|
var en$1 = {
|
|
15
16
|
"auth-logout-go-back-to-home-page": "Go back to the <1>Home Page</1>",
|
|
@@ -426,7 +427,6 @@ var SessionStorageKey;
|
|
|
426
427
|
SessionStorageKey["OAUTH_CODE_CHALLENGE"] = "code_challenge";
|
|
427
428
|
SessionStorageKey["HAS_AUTHENTICATED"] = "has_authenticated";
|
|
428
429
|
SessionStorageKey["CALLBACK_URL"] = "callback_url";
|
|
429
|
-
SessionStorageKey["LANGUAGE"] = "en";
|
|
430
430
|
})(SessionStorageKey || (SessionStorageKey = {}));
|
|
431
431
|
var getSessionStorageProvider = function getSessionStorageProvider() {
|
|
432
432
|
var _window = window,
|
|
@@ -479,12 +479,6 @@ var getSessionStorageProvider = function getSessionStorageProvider() {
|
|
|
479
479
|
},
|
|
480
480
|
setCallbackUrl: function setCallbackUrl(value) {
|
|
481
481
|
return sessionStorage.setItem(SessionStorageKey.CALLBACK_URL, value);
|
|
482
|
-
},
|
|
483
|
-
getLanguage: function getLanguage() {
|
|
484
|
-
return sessionStorage.getItem(SessionStorageKey.LANGUAGE);
|
|
485
|
-
},
|
|
486
|
-
setLanguage: function setLanguage(value) {
|
|
487
|
-
return sessionStorage.setItem(SessionStorageKey.LANGUAGE, value);
|
|
488
482
|
}
|
|
489
483
|
};
|
|
490
484
|
};
|
|
@@ -1119,9 +1113,14 @@ var HandleOAuth2Code = function HandleOAuth2Code() {
|
|
|
1119
1113
|
_context.prev = 23;
|
|
1120
1114
|
_context.t0 = _context["catch"](15);
|
|
1121
1115
|
if (isMounted.current) {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1116
|
+
if (_context.t0 instanceof Error) {
|
|
1117
|
+
setError(function () {
|
|
1118
|
+
return {
|
|
1119
|
+
message: _context.t0.message,
|
|
1120
|
+
stack: _context.t0.stack || 'Error in HandleOAuth2Code'
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1125
1124
|
if (sessionStorageProvider) {
|
|
1126
1125
|
sessionStorageProvider.removeOauthState();
|
|
1127
1126
|
sessionStorageProvider.removeOauthCodeVerifier();
|
|
@@ -1194,13 +1193,25 @@ var HandleOAuth2Code = function HandleOAuth2Code() {
|
|
|
1194
1193
|
* See the License for the specific language governing permissions and
|
|
1195
1194
|
* limitations under the License.
|
|
1196
1195
|
*
|
|
1197
|
-
* Copyright
|
|
1198
|
-
* Copyright
|
|
1196
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1197
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
1199
1198
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1200
1199
|
* */
|
|
1201
1200
|
var getCurrentUrlLocation = function getCurrentUrlLocation(url, appUrl) {
|
|
1202
1201
|
return url ? url.replace(appUrl, '') : '/';
|
|
1203
1202
|
};
|
|
1203
|
+
var createAuthenticationTestStore = function createAuthenticationTestStore(preloadedState) {
|
|
1204
|
+
var store = configureStore({
|
|
1205
|
+
reducer: {
|
|
1206
|
+
snackbar: snackbarReducer
|
|
1207
|
+
},
|
|
1208
|
+
middleware: function middleware(getDefaultMiddleware) {
|
|
1209
|
+
return getDefaultMiddleware().prepend(snackbarListener.middleware);
|
|
1210
|
+
},
|
|
1211
|
+
preloadedState: preloadedState
|
|
1212
|
+
});
|
|
1213
|
+
return store;
|
|
1214
|
+
};
|
|
1204
1215
|
|
|
1205
1216
|
/* *
|
|
1206
1217
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1499,7 +1510,9 @@ var useApi = function useApi(apiCall, params, callbacks) {
|
|
|
1499
1510
|
case 9:
|
|
1500
1511
|
_context.prev = 9;
|
|
1501
1512
|
_context.t0 = _context["catch"](2);
|
|
1502
|
-
|
|
1513
|
+
if (_context.t0 instanceof Error) {
|
|
1514
|
+
handleError(_context.t0);
|
|
1515
|
+
}
|
|
1503
1516
|
case 12:
|
|
1504
1517
|
_context.prev = 12;
|
|
1505
1518
|
setIsloading(false);
|
|
@@ -1534,4 +1547,4 @@ var useApi = function useApi(apiCall, params, callbacks) {
|
|
|
1534
1547
|
};
|
|
1535
1548
|
};
|
|
1536
1549
|
|
|
1537
|
-
export { AUTH_NAMESPACE, ApiProvider, AuthenticationContext, AuthenticationProvider, HandleOAuth2Code as Code, GEOWEB_ROLE_PRESETS_ADMIN, GEOWEB_ROLE_USER, KEEP_ALIVE_POLLER_IN_SECONDS, OAuth2Login as Login, OAuth2Logout as Logout, MILLISECOND_TO_SECOND, REFRESH_TOKEN_WHEN_PCT_EXPIRED, RequireAuth, SessionStorageKey, UserMenuRoles, UserMenuRolesConnect, apiTranslations, authTranslations, createApiInstance, createFakeApiInstance, createNonAuthApiInstance, fakeApiRequest, getApi, getAuthConfig, getCodeChallenge, getConfig, getCurrentTimeInSeconds, getCurrentUrlLocation, getRandomString, getSessionStorageProvider, groupsToRoles, makeCredentialsFromTokenResponse, refreshAccessToken, refreshAccessTokenAndSetAuthContext, useApi, useApiContext, useAuthenticationContext, useAuthenticationDefaultProps };
|
|
1550
|
+
export { AUTH_NAMESPACE, ApiProvider, AuthenticationContext, AuthenticationProvider, HandleOAuth2Code as Code, GEOWEB_ROLE_PRESETS_ADMIN, GEOWEB_ROLE_USER, KEEP_ALIVE_POLLER_IN_SECONDS, OAuth2Login as Login, OAuth2Logout as Logout, MILLISECOND_TO_SECOND, REFRESH_TOKEN_WHEN_PCT_EXPIRED, RequireAuth, SessionStorageKey, UserMenuRoles, UserMenuRolesConnect, apiTranslations, authTranslations, createApiInstance, createAuthenticationTestStore, createFakeApiInstance, createNonAuthApiInstance, fakeApiRequest, getApi, getAuthConfig, getCodeChallenge, getConfig, getCurrentTimeInSeconds, getCurrentUrlLocation, getRandomString, getSessionStorageProvider, groupsToRoles, makeCredentialsFromTokenResponse, refreshAccessToken, refreshAccessTokenAndSetAuthContext, useApi, useApiContext, useAuthenticationContext, useAuthenticationDefaultProps };
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Store } from '@reduxjs/toolkit';
|
|
3
|
+
import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
|
|
3
4
|
interface AuthTranslationWrapperProps {
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
}
|
|
@@ -8,4 +9,8 @@ export declare const DemoWrapper: React.FC<AuthTranslationWrapperProps>;
|
|
|
8
9
|
export declare const DemoWrapperConnect: React.FC<AuthTranslationWrapperProps & {
|
|
9
10
|
store: Store;
|
|
10
11
|
}>;
|
|
12
|
+
export declare const createTestAuthenticationStore: () => ToolkitStore;
|
|
13
|
+
export declare const DemoWrapperNoEggsConnect: React.FC<AuthTranslationWrapperProps & {
|
|
14
|
+
store: Store;
|
|
15
|
+
}>;
|
|
11
16
|
export {};
|
|
@@ -16,8 +16,6 @@ export interface SessionStorageProvider {
|
|
|
16
16
|
removeHasAuthenticated: () => void;
|
|
17
17
|
getCallbackUrl: () => string;
|
|
18
18
|
setCallbackUrl: (value: string) => void;
|
|
19
|
-
getLanguage: () => string;
|
|
20
|
-
setLanguage: (value: string) => void;
|
|
21
19
|
}
|
|
22
20
|
export declare enum SessionStorageKey {
|
|
23
21
|
CONFIG = "config",
|
|
@@ -25,8 +23,7 @@ export declare enum SessionStorageKey {
|
|
|
25
23
|
OAUTH_CODE_VERIFIER = "code_verifier",
|
|
26
24
|
OAUTH_CODE_CHALLENGE = "code_challenge",
|
|
27
25
|
HAS_AUTHENTICATED = "has_authenticated",
|
|
28
|
-
CALLBACK_URL = "callback_url"
|
|
29
|
-
LANGUAGE = "en"
|
|
26
|
+
CALLBACK_URL = "callback_url"
|
|
30
27
|
}
|
|
31
28
|
export declare const getSessionStorageProvider: () => SessionStorageProvider;
|
|
32
29
|
export declare const getConfig: () => ConfigType;
|
package/src/lib/utils/utils.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
+
import { ConfigureStoreOptions, ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
|
|
1
2
|
export declare const getCurrentUrlLocation: (url: string, appUrl: string) => string;
|
|
3
|
+
export declare const createAuthenticationTestStore: (preloadedState?: ConfigureStoreOptions['preloadedState']) => ToolkitStore;
|