@opengeoweb/authentication 9.16.0 → 9.18.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.
Files changed (30) hide show
  1. package/index.esm.js +1694 -849
  2. package/package.json +6 -2
  3. package/src/index.d.ts +7 -5
  4. package/src/lib/components/AuthenticationContext/types.d.ts +22 -0
  5. package/src/lib/components/Providers/Providers.d.ts +11 -0
  6. package/src/lib/components/UserMenuRoles/UserMenuRoles.d.ts +11 -0
  7. package/src/lib/components/UserMenuRoles/UserMenuRolesConnect.d.ts +6 -0
  8. package/src/lib/components/UserMenuRoles/UserMenuRolesConnect.stories.d.ts +6 -0
  9. package/src/lib/components/UserMenuRoles/index.d.ts +3 -0
  10. package/src/lib/components/pages/Login.spec.d.ts +1 -0
  11. package/src/lib/components/pages/Logout.spec.d.ts +1 -0
  12. package/src/lib/utils/i18n.d.ts +4 -0
  13. package/src/lib/utils/session.d.ts +23 -1
  14. package/src/lib/AuthenticationContext/types.d.ts +0 -42
  15. package/src/lib/Providers/Providers.d.ts +0 -6
  16. /package/src/lib/{AuthenticationContext → components/AuthenticationContext}/AuthenticationContext.d.ts +0 -0
  17. /package/src/lib/{AuthenticationContext → components/AuthenticationContext}/AuthenticationContext.spec.d.ts +0 -0
  18. /package/src/lib/{AuthenticationContext → components/AuthenticationContext}/AuthenticationRenderTestComponent.d.ts +0 -0
  19. /package/src/lib/{AuthenticationContext → components/AuthenticationContext}/AuthenticationRenderTestComponent.spec.d.ts +0 -0
  20. /package/src/lib/{AuthenticationContext → components/AuthenticationContext}/index.d.ts +0 -0
  21. /package/src/lib/{PrivateRoute → components/PrivateRoute}/RequireAuth.d.ts +0 -0
  22. /package/src/lib/{PrivateRoute → components/PrivateRoute}/RequireAuth.spec.d.ts +0 -0
  23. /package/src/lib/{PrivateRoute → components/PrivateRoute}/index.d.ts +0 -0
  24. /package/src/lib/{Providers → components/Providers}/index.d.ts +0 -0
  25. /package/src/lib/{pages/Code.spec.d.ts → components/UserMenuRoles/UserMenuRoles.spec.d.ts} +0 -0
  26. /package/src/lib/{pages/Login.spec.d.ts → components/UserMenuRoles/UserMenuRolesConnect.spec.d.ts} +0 -0
  27. /package/src/lib/{pages → components/pages}/Code.d.ts +0 -0
  28. /package/src/lib/{pages/Logout.spec.d.ts → components/pages/Code.spec.d.ts} +0 -0
  29. /package/src/lib/{pages → components/pages}/Login.d.ts +0 -0
  30. /package/src/lib/{pages → components/pages}/Logout.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/authentication",
3
- "version": "9.16.0",
3
+ "version": "9.18.0",
4
4
  "description": "GeoWeb authentication library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,11 @@
14
14
  "@opengeoweb/shared": "*",
15
15
  "@opengeoweb/theme": "*",
16
16
  "i18next": "^23.7.11",
17
- "react-i18next": "^13.5.0"
17
+ "react-i18next": "^13.5.0",
18
+ "@opengeoweb/snackbar": "9.18.0",
19
+ "react-redux": "^8.1.3",
20
+ "@reduxjs/toolkit": "^1.9.7",
21
+ "@mui/material": "~5.15.11"
18
22
  },
19
23
  "peerDependencies": {
20
24
  "react": "18"
package/src/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import authTranslations from '../locales/authentication.json';
2
- export { default as Code } from './lib/pages/Code';
3
- export { default as Login } from './lib/pages/Login';
4
- export { default as Logout } from './lib/pages/Logout';
5
- export * from './lib/AuthenticationContext';
6
- export * from './lib/PrivateRoute';
2
+ export { default as Code } from './lib/components/pages/Code';
3
+ export { default as Login } from './lib/components/pages/Login';
4
+ export { default as Logout } from './lib/components/pages/Logout';
5
+ export * from './lib/components/UserMenuRoles';
6
+ export * from './lib/components/AuthenticationContext';
7
+ export * from './lib/components/PrivateRoute';
7
8
  export * from './lib/utils/session';
8
9
  export * from './lib/utils/utils';
10
+ export { AUTH_NAMESPACE } from './lib/utils/i18n';
9
11
  export { authTranslations };
@@ -0,0 +1,22 @@
1
+ import { Credentials } from '@opengeoweb/api';
2
+ import { SessionStorageProvider } from '../../utils/session';
3
+ export interface AuthenticationConfig {
4
+ GW_AUTH_LOGIN_URL: string;
5
+ GW_AUTH_LOGOUT_URL: string;
6
+ GW_AUTH_TOKEN_URL: string;
7
+ GW_AUTH_ROLE_CLAIM_NAME?: string;
8
+ GW_AUTH_ROLE_CLAIM_VALUE_PRESETS_ADMIN?: string;
9
+ GW_APP_URL: string;
10
+ GW_BE_VERSION_BASE_URL?: string;
11
+ GW_AUTH_CLIENT_ID: string;
12
+ }
13
+ export interface AuthenticationDefaultStateProps {
14
+ isLoggedIn: boolean;
15
+ onLogin: (isLoggedIn: boolean) => void;
16
+ auth: Credentials | null;
17
+ onSetAuth: (auth: Credentials) => void;
18
+ sessionStorageProvider: SessionStorageProvider;
19
+ }
20
+ export interface AuthenticationContextProps extends AuthenticationDefaultStateProps {
21
+ authConfig: AuthenticationConfig;
22
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Store } from '@reduxjs/toolkit';
3
+ interface AuthTranslationWrapperProps {
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare const AuthI18nProvider: React.FC<AuthTranslationWrapperProps>;
7
+ export declare const DemoWrapper: React.FC<AuthTranslationWrapperProps>;
8
+ export declare const DemoWrapperConnect: React.FC<AuthTranslationWrapperProps & {
9
+ store: Store;
10
+ }>;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface Role {
3
+ name: string;
4
+ title: string;
5
+ }
6
+ export declare const UserMenuRoles: React.FC<{
7
+ roles?: Role[];
8
+ currentRole?: string;
9
+ onChangeRole: (role: Role) => void;
10
+ isLoading: boolean;
11
+ }>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Role } from './UserMenuRoles';
3
+ export declare const UserMenuRolesConnect: React.FC<{
4
+ temporaryOnChangeRoleForDemo?: (role: Role) => void;
5
+ roles?: Role[];
6
+ }>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const AuthenticationDemo: React.FC;
@@ -0,0 +1,3 @@
1
+ export { UserMenuRoles } from './UserMenuRoles';
2
+ export type { Role } from './UserMenuRoles';
3
+ export * from './UserMenuRolesConnect';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,6 @@
1
+ import i18n from 'i18next';
2
+ import { UseTranslationResponse } from 'react-i18next';
1
3
  export declare const AUTH_NAMESPACE = "auth";
2
4
  export declare const initAuthTestI18n: () => void;
5
+ export declare const useAuthenticationTranslation: () => UseTranslationResponse<typeof AUTH_NAMESPACE, typeof i18n>;
6
+ export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
@@ -1,2 +1,24 @@
1
- import { SessionStorageProvider } from '../AuthenticationContext/types';
1
+ export interface SessionStorageProvider {
2
+ setOauthState: (value: string) => void;
3
+ getOauthState: () => string;
4
+ removeOauthState: () => void;
5
+ setOauthCodeVerifier: (value: string) => void;
6
+ getOauthCodeVerifier: () => string;
7
+ removeOauthCodeVerifier: () => void;
8
+ setOauthCodeChallenge: (value: string) => void;
9
+ getOauthCodeChallenge: () => string;
10
+ removeOauthCodeChallenge: () => void;
11
+ setHasAuthenticated: (value: string) => void;
12
+ getHasAuthenticated: () => string;
13
+ removeHasAuthenticated: () => void;
14
+ getCallbackUrl: () => string;
15
+ setCallbackUrl: (value: string) => void;
16
+ }
17
+ export declare enum SessionStorageKey {
18
+ OAUTH_STATE = "oauth_state",
19
+ OAUTH_CODE_VERIFIER = "code_verifier",
20
+ OAUTH_CODE_CHALLENGE = "code_challenge",
21
+ HAS_AUTHENTICATED = "has_authenticated",
22
+ CALLBACK_URL = "callback_url"
23
+ }
2
24
  export declare const getSessionStorageProvider: () => SessionStorageProvider;
@@ -1,42 +0,0 @@
1
- import { Credentials } from '@opengeoweb/api';
2
- export interface AuthenticationConfig {
3
- GW_AUTH_LOGIN_URL: string;
4
- GW_AUTH_LOGOUT_URL: string;
5
- GW_AUTH_TOKEN_URL: string;
6
- GW_APP_URL: string;
7
- GW_BE_VERSION_BASE_URL?: string;
8
- GW_AUTH_CLIENT_ID: string;
9
- }
10
- export interface SessionStorageProvider {
11
- setOauthState: (value: string) => void;
12
- getOauthState: () => string;
13
- removeOauthState: () => void;
14
- setOauthCodeVerifier: (value: string) => void;
15
- getOauthCodeVerifier: () => string;
16
- removeOauthCodeVerifier: () => void;
17
- setOauthCodeChallenge: (value: string) => void;
18
- getOauthCodeChallenge: () => string;
19
- removeOauthCodeChallenge: () => void;
20
- setHasAuthenticated: (value: string) => void;
21
- getHasAuthenticated: () => string;
22
- removeHasAuthenticated: () => void;
23
- getCallbackUrl: () => string;
24
- setCallbackUrl: (value: string) => void;
25
- }
26
- export declare enum SessionStorageKey {
27
- OAUTH_STATE = "oauth_state",
28
- OAUTH_CODE_VERIFIER = "code_verifier",
29
- OAUTH_CODE_CHALLENGE = "code_challenge",
30
- HAS_AUTHENTICATED = "has_authenticated",
31
- CALLBACK_URL = "callback_url"
32
- }
33
- export interface AuthenticationDefaultStateProps {
34
- isLoggedIn: boolean;
35
- onLogin: (isLoggedIn: boolean) => void;
36
- auth: Credentials | null;
37
- onSetAuth: (auth: Credentials) => void;
38
- sessionStorageProvider: SessionStorageProvider;
39
- }
40
- export interface AuthenticationContextProps extends AuthenticationDefaultStateProps {
41
- authConfig: AuthenticationConfig;
42
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface AuthTranslationWrapperProps {
3
- children?: React.ReactNode;
4
- }
5
- export declare const AuthI18nProvider: React.FC<AuthTranslationWrapperProps>;
6
- export {};
File without changes
File without changes
File without changes