@opengeoweb/authentication 20.0.1 → 20.1.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/dist/index.esm.js
CHANGED
|
@@ -713,6 +713,17 @@ var AuthenticationContext = /*#__PURE__*/React.createContext({
|
|
|
713
713
|
sessionStorageProvider: null,
|
|
714
714
|
currentRole: null
|
|
715
715
|
});
|
|
716
|
+
// `contextValue` below is stable across token refreshes, so token and
|
|
717
|
+
// has_connection_issue -- which change independently of login state -- get
|
|
718
|
+
// their own narrow contexts for consumers that need to react to them.
|
|
719
|
+
var AuthTokenContext = /*#__PURE__*/React.createContext(undefined);
|
|
720
|
+
var useAuthToken = function useAuthToken() {
|
|
721
|
+
return React.useContext(AuthTokenContext);
|
|
722
|
+
};
|
|
723
|
+
var HasConnectionIssueContext = /*#__PURE__*/React.createContext(undefined);
|
|
724
|
+
var useHasConnectionIssue = function useHasConnectionIssue() {
|
|
725
|
+
return React.useContext(HasConnectionIssueContext);
|
|
726
|
+
};
|
|
716
727
|
var authChangeListener = null;
|
|
717
728
|
var setAuthChangeListener = function setAuthChangeListener(listener) {
|
|
718
729
|
authChangeListener = listener;
|
|
@@ -856,18 +867,16 @@ var AuthenticationProvider = function AuthenticationProvider(_ref2) {
|
|
|
856
867
|
currentRole: currentRole,
|
|
857
868
|
setCurrentRole: setCurrentRole
|
|
858
869
|
};
|
|
859
|
-
},
|
|
860
|
-
// `auth` is a mutable ref (see the hotfix note in
|
|
861
|
-
// useAuthenticationDefaultProps), so its identity never changes when its
|
|
862
|
-
// contents do -- eslint can't know that, and considers the fields below
|
|
863
|
-
// redundant with `auth`. They're not: depending on them individually is
|
|
864
|
-
// what makes this memo (and therefore the context value handed to
|
|
865
|
-
// consumers) actually update when e.g. the access token is refreshed.
|
|
866
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
867
|
-
[isLoggedIn, onLogin, auth, auth == null ? void 0 : auth.token, auth == null ? void 0 : auth.refresh_token, auth == null ? void 0 : auth.expires_at, auth == null ? void 0 : auth.has_connection_issue, auth == null ? void 0 : auth.username, auth == null ? void 0 : auth.roles, onSetAuth, authConfig, sessionStorageProvider, currentRole, setCurrentRole]);
|
|
870
|
+
}, [isLoggedIn, onLogin, auth, onSetAuth, authConfig, sessionStorageProvider, currentRole, setCurrentRole]);
|
|
868
871
|
return jsx(AuthenticationContext.Provider, {
|
|
869
872
|
value: contextValue,
|
|
870
|
-
children:
|
|
873
|
+
children: jsx(AuthTokenContext.Provider, {
|
|
874
|
+
value: auth == null ? void 0 : auth.token,
|
|
875
|
+
children: jsx(HasConnectionIssueContext.Provider, {
|
|
876
|
+
value: auth == null ? void 0 : auth.has_connection_issue,
|
|
877
|
+
children: children
|
|
878
|
+
})
|
|
879
|
+
})
|
|
871
880
|
});
|
|
872
881
|
};
|
|
873
882
|
var useAuthenticationContext = function useAuthenticationContext() {
|
|
@@ -1459,4 +1468,4 @@ params, callbacks) {
|
|
|
1459
1468
|
};
|
|
1460
1469
|
};
|
|
1461
1470
|
|
|
1462
|
-
export { AUTH_NAMESPACE, AuthFetchTrustedServicesProvider, 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, OIDC_NO_INTERACTION_ERROR_CODES, REFRESH_TOKEN_WHEN_PCT_EXPIRED, UserMenuRoles, apiTranslations, authFetch, authTranslations, broadcastLogout, buildSilentLoginUrl, clearSession, clearSilentLoginAttempt, clearSilentLoginSuppression, createApiInstance, createFakeApiInstance, createLogoutBroadcastChannel, createNonAuthApiInstance, enableAuthFetchTrustedServices, extendHeadersWithJWTAccessToken, fakeApiRequest, getAuthConfig, getCodeChallenge, getCurrentTimeInSeconds, getCurrentUrlLocation, getRandomString, groupsToRoles, hasRecentSilentLoginAttempt, isSilentLoginEnabled, isSilentLoginSuppressed, makeCredentialsFromTokenResponse, recordSilentLoginAttempt, refreshAccessToken, refreshAccessTokenAndSetAuthContext, resetAuthFetchTrustedServices, setAuthChangeListener, setJWTAccessTokenForTrustedServices, suppressSilentLogin, useApi, useAuthFetchToken, useAuthenticationContext, useAuthenticationDefaultProps };
|
|
1471
|
+
export { AUTH_NAMESPACE, AuthFetchTrustedServicesProvider, 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, OIDC_NO_INTERACTION_ERROR_CODES, REFRESH_TOKEN_WHEN_PCT_EXPIRED, UserMenuRoles, apiTranslations, authFetch, authTranslations, broadcastLogout, buildSilentLoginUrl, clearSession, clearSilentLoginAttempt, clearSilentLoginSuppression, createApiInstance, createFakeApiInstance, createLogoutBroadcastChannel, createNonAuthApiInstance, enableAuthFetchTrustedServices, extendHeadersWithJWTAccessToken, fakeApiRequest, getAuthConfig, getCodeChallenge, getCurrentTimeInSeconds, getCurrentUrlLocation, getRandomString, groupsToRoles, hasRecentSilentLoginAttempt, isSilentLoginEnabled, isSilentLoginSuppressed, makeCredentialsFromTokenResponse, recordSilentLoginAttempt, refreshAccessToken, refreshAccessTokenAndSetAuthContext, resetAuthFetchTrustedServices, setAuthChangeListener, setJWTAccessTokenForTrustedServices, suppressSilentLogin, useApi, useAuthFetchToken, useAuthToken, useAuthenticationContext, useAuthenticationDefaultProps, useHasConnectionIssue };
|
|
@@ -6,6 +6,8 @@ export declare const getCodeChallenge: (codeVerifier: string) => Promise<string>
|
|
|
6
6
|
export declare const replaceTemplateKeys: (url: string, clientId: string, appUrl: string, oauthState?: string, codeChallenge?: string) => string;
|
|
7
7
|
export declare const getAuthConfig: (_configUrls: AuthenticationConfig) => AuthenticationConfig;
|
|
8
8
|
export declare const AuthenticationContext: React.Context<AuthenticationContextProps>;
|
|
9
|
+
export declare const useAuthToken: () => string | undefined;
|
|
10
|
+
export declare const useHasConnectionIssue: () => boolean | undefined;
|
|
9
11
|
type OnAuthChange = (isLoggedIn: boolean, auth: Credentials | null) => void;
|
|
10
12
|
export declare const setAuthChangeListener: (listener: OnAuthChange) => void;
|
|
11
13
|
export declare const clearSession: (onSetAuth: AuthenticationDefaultStateProps["onSetAuth"], onLogin: AuthenticationDefaultStateProps["onLogin"], sessionStorageProviderArg: AuthenticationDefaultStateProps["sessionStorageProvider"]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useAuthenticationContext, AuthenticationProvider, useAuthenticationDefaultProps, AuthenticationContext, clearSession, getAuthConfig, getRandomString, getCodeChallenge, setAuthChangeListener, } from './AuthenticationContext';
|
|
1
|
+
export { useAuthenticationContext, useAuthToken, useHasConnectionIssue, AuthenticationProvider, useAuthenticationDefaultProps, AuthenticationContext, clearSession, getAuthConfig, getRandomString, getCodeChallenge, setAuthChangeListener, } from './AuthenticationContext';
|
|
2
2
|
export type * from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/authentication",
|
|
3
|
-
"version": "20.0
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "GeoWeb authentication library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"axios": "^1.
|
|
24
|
-
"@opengeoweb/shared": "20.0
|
|
25
|
-
"@opengeoweb/theme": "20.0
|
|
23
|
+
"axios": "^1.20.0",
|
|
24
|
+
"@opengeoweb/shared": "20.1.0",
|
|
25
|
+
"@opengeoweb/theme": "20.1.0",
|
|
26
26
|
"i18next": "^25.0.1",
|
|
27
27
|
"react-i18next": "^15.1.1",
|
|
28
28
|
"@mui/material": "^9.0.1",
|