@deephaven/auth-plugins 0.67.1-beta.0 → 0.67.1-beta.1
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/AuthPluginBase.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
3
3
|
export type AuthPluginBaseProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The children to render after authentication is completed.
|
|
@@ -9,7 +9,7 @@ export type AuthPluginBaseProps = {
|
|
|
9
9
|
* Retrieve the login options for logging in to the client
|
|
10
10
|
* @returns A promise for the login options
|
|
11
11
|
*/
|
|
12
|
-
getLoginOptions: () =>
|
|
12
|
+
getLoginOptions: () => dh.LoginCredentials | Promise<dh.LoginCredentials>;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Base AuthPlugin that gets passed a function for retrieving the login options, and then attempting to login with them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPluginBase.d.ts","sourceRoot":"","sources":["../src/AuthPluginBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AuthPluginBase.d.ts","sourceRoot":"","sources":["../src/AuthPluginBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAMjD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC,gBAAgB,GAAG,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC;CAC3E,CAAC;AAEF;;;GAGG;AACH,iBAAS,cAAc,CAAC,EACtB,QAAQ,EACR,eAAe,GAChB,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAmDnC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPluginBase.js","names":["React","useEffect","useState","LoadingOverlay","useClient","Log","CanceledPromiseError","getErrorMessage","AuthenticationError","jsx","_jsx","Fragment","_Fragment","log","module","AuthPluginBase","_ref","children","getLoginOptions","client","error","setError","isLoggedIn","setIsLoggedIn","isCanceled","verifyNotCanceled","login","_login","apply","arguments","_asyncToGenerator","loginOptions","info","e","_getErrorMessage","message","isLoading","isLoaded","errorMessage"],"sources":["../src/AuthPluginBase.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport Log from '@deephaven/log';\nimport type {
|
|
1
|
+
{"version":3,"file":"AuthPluginBase.js","names":["React","useEffect","useState","LoadingOverlay","useClient","Log","CanceledPromiseError","getErrorMessage","AuthenticationError","jsx","_jsx","Fragment","_Fragment","log","module","AuthPluginBase","_ref","children","getLoginOptions","client","error","setError","isLoggedIn","setIsLoggedIn","isCanceled","verifyNotCanceled","login","_login","apply","arguments","_asyncToGenerator","loginOptions","info","e","_getErrorMessage","message","isLoading","isLoaded","errorMessage"],"sources":["../src/AuthPluginBase.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport Log from '@deephaven/log';\nimport type { dh } from '@deephaven/jsapi-types';\nimport { CanceledPromiseError, getErrorMessage } from '@deephaven/utils';\nimport AuthenticationError from './AuthenticationError';\n\nconst log = Log.module('AuthPluginBase');\n\nexport type AuthPluginBaseProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n\n /**\n * Retrieve the login options for logging in to the client\n * @returns A promise for the login options\n */\n getLoginOptions: () => dh.LoginCredentials | Promise<dh.LoginCredentials>;\n};\n\n/**\n * Base AuthPlugin that gets passed a function for retrieving the login options, and then attempting to login with them.\n * @param getLoginOptions Function that returns a promise for the login options\n */\nfunction AuthPluginBase({\n children,\n getLoginOptions,\n}: AuthPluginBaseProps): JSX.Element {\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [isLoggedIn, setIsLoggedIn] = useState(false);\n\n useEffect(() => {\n let isCanceled = false;\n function verifyNotCanceled(): void {\n if (isCanceled) {\n throw new CanceledPromiseError('Login canceled.');\n }\n }\n async function login(): Promise<void> {\n try {\n const loginOptions = await getLoginOptions();\n verifyNotCanceled();\n\n log.info('Logging in...');\n await client.login(loginOptions);\n verifyNotCanceled();\n\n setIsLoggedIn(true);\n } catch (e) {\n if (!isCanceled) {\n log.error('Unable to login:', e);\n const message =\n getErrorMessage(e) ?? 'Unable to login. Verify credentials.';\n setError(new AuthenticationError(message));\n setIsLoggedIn(false);\n }\n }\n }\n login();\n return () => {\n isCanceled = true;\n };\n }, [client, getLoginOptions]);\n\n if (!isLoggedIn) {\n return (\n <LoadingOverlay\n data-testid=\"auth-base-loading\"\n isLoading={error == null}\n isLoaded={false}\n errorMessage={getErrorMessage(error)}\n />\n );\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default AuthPluginBase;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,4BAA4B;AACtD,OAAOC,GAAG,MAAM,gBAAgB;AAEhC,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,kBAAkB;AAAC,OAClEC,mBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAE1B,IAAMC,GAAG,GAAGR,GAAG,CAACS,MAAM,CAAC,gBAAgB,CAAC;AAexC;AACA;AACA;AACA;A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MAAA,CAAAC,KAAA,OAAAC,SAAA;IAAA;IACDH,KAAK,CAAC,CAAC;IACP,OAAO,MAAM;MACXF,UAAU,GAAG,IAAI;IACnB,CAAC;EACH,CAAC,EAAE,CAACL,MAAM,EAAED,eAAe,CAAC,CAAC;EAE7B,IAAI,CAACI,UAAU,EAAE;IACf,oBACEZ,IAAA,CAACP,cAAc;MACb,eAAY,mBAAmB;MAC/BiC,SAAS,EAAEhB,KAAK,IAAI,IAAK;MACzBiB,QAAQ,EAAE,KAAM;MAChBC,YAAY,EAAE/B,eAAe,CAACa,KAAK;IAAE,CACtC,CAAC;EAEN;;EAEA;EACA,oBAAOV,IAAA,CAAAE,SAAA;IAAAK,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB;AAEA,eAAeF,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPluginParent.d.ts","sourceRoot":"","sources":["../src/AuthPluginParent.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthPluginParent.d.ts","sourceRoot":"","sources":["../src/AuthPluginParent.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AA2C3D,QAAA,MAAM,gBAAgB,EAAE,UAIvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPluginParent.js","names":["React","getWindowParent","LOGIN_OPTIONS_REQUEST","requestParentResponse","Log","AuthPluginBase","UserPermissionsOverrideContext","jsx","_jsx","log","module","permissionsOverrides","canLogout","isLoginOptions","options","type","getLoginOptions","_getLoginOptions","apply","arguments","_asyncToGenerator","info","response","Error","concat","getWindowAuthProvider","_URLSearchParams$get","URLSearchParams","window","location","search","get","Component","_ref","children","Provider","value","AuthPluginParent","isAvailable"],"sources":["../src/AuthPluginParent.tsx"],"sourcesContent":["import React from 'react';\nimport type {
|
|
1
|
+
{"version":3,"file":"AuthPluginParent.js","names":["React","getWindowParent","LOGIN_OPTIONS_REQUEST","requestParentResponse","Log","AuthPluginBase","UserPermissionsOverrideContext","jsx","_jsx","log","module","permissionsOverrides","canLogout","isLoginOptions","options","type","getLoginOptions","_getLoginOptions","apply","arguments","_asyncToGenerator","info","response","Error","concat","getWindowAuthProvider","_URLSearchParams$get","URLSearchParams","window","location","search","get","Component","_ref","children","Provider","value","AuthPluginParent","isAvailable"],"sources":["../src/AuthPluginParent.tsx"],"sourcesContent":["import React from 'react';\nimport type { dh } from '@deephaven/jsapi-types';\nimport {\n getWindowParent,\n LOGIN_OPTIONS_REQUEST,\n requestParentResponse,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { AuthPlugin, AuthPluginProps } from './AuthPlugin';\nimport AuthPluginBase from './AuthPluginBase';\nimport {\n UserPermissionsOverride,\n UserPermissionsOverrideContext,\n} from './UserContexts';\n\nconst log = Log.module('AuthPluginParent');\n\nconst permissionsOverrides: UserPermissionsOverride = { canLogout: false };\n\nfunction isLoginOptions(options: unknown): options is dh.LoginCredentials {\n return (\n options != null && typeof (options as dh.LoginCredentials).type === 'string'\n );\n}\n\nasync function getLoginOptions(): Promise<dh.LoginCredentials> {\n log.info('Logging in by delegating to parent window...');\n const response = await requestParentResponse(LOGIN_OPTIONS_REQUEST);\n if (!isLoginOptions(response)) {\n throw new Error(`Unexpected login options response: ${response}`);\n }\n return response;\n}\n\nfunction getWindowAuthProvider(): string {\n return new URLSearchParams(window.location.search).get('authProvider') ?? '';\n}\n\n/**\n * AuthPlugin that tries to delegate to the parent window for authentication. Fails if there is no parent window.\n */\nfunction Component({ children }: AuthPluginProps): JSX.Element {\n return (\n <AuthPluginBase getLoginOptions={getLoginOptions}>\n <UserPermissionsOverrideContext.Provider value={permissionsOverrides}>\n {children}\n </UserPermissionsOverrideContext.Provider>\n </AuthPluginBase>\n );\n}\n\nconst AuthPluginParent: AuthPlugin = {\n Component,\n isAvailable: () =>\n getWindowParent() != null && getWindowAuthProvider() === 'parent',\n};\n\nexport default AuthPluginParent;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SACEC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,QAChB,wBAAwB;AAC/B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAE1BC,cAAc;AAAA,SAGnBC,8BAA8B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhC,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,kBAAkB,CAAC;AAE1C,IAAMC,oBAA6C,GAAG;EAAEC,SAAS,EAAE;AAAM,CAAC;AAE1E,SAASC,cAAcA,CAACC,OAAgB,EAAkC;EACxE,OACEA,OAAO,IAAI,IAAI,IAAI,OAAQA,OAAO,CAAyBC,IAAI,KAAK,QAAQ;AAEhF;AAAC,SAEcC,eAAeA,CAAA;EAAA,OAAAC,gBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,iBAAA;EAAAA,gBAAA,GAAAG,iBAAA,CAA9B,aAA+D;IAC7DX,GAAG,CAACY,IAAI,CAAC,8CAA8C,CAAC;IACxD,IAAMC,QAAQ,SAASnB,qBAAqB,CAACD,qBAAqB,CAAC;IACnE,IAAI,CAACW,cAAc,CAACS,QAAQ,CAAC,EAAE;MAC7B,MAAM,IAAIC,KAAK,uCAAAC,MAAA,CAAuCF,QAAQ,CAAE,CAAC;IACnE;IACA,OAAOA,QAAQ;EACjB,CAAC;EAAA,OAAAL,gBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAED,SAASM,qBAAqBA,CAAA,EAAW;EAAA,IAAAC,oBAAA;EACvC,QAAAA,oBAAA,GAAO,IAAIC,eAAe,CAACC,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAC,CAACC,GAAG,CAAC,cAAc,CAAC,cAAAL,oBAAA,cAAAA,oBAAA,GAAI,EAAE;AAC9E;;AAEA;AACA;AACA;AACA,SAASM,SAASA,CAAAC,IAAA,EAA6C;EAAA,IAA5C;IAAEC;EAA0B,CAAC,GAAAD,IAAA;EAC9C,oBACEzB,IAAA,CAACH,cAAc;IAACW,eAAe,EAAEA,eAAgB;IAAAkB,QAAA,eAC/C1B,IAAA,CAACF,8BAA8B,CAAC6B,QAAQ;MAACC,KAAK,EAAEzB,oBAAqB;MAAAuB,QAAA,EAClEA;IAAQ,CAC8B;EAAC,CAC5B,CAAC;AAErB;AAEA,IAAMG,gBAA4B,GAAG;EACnCL,SAAS;EACTM,WAAW,EAAEA,CAAA,KACXrC,eAAe,CAAC,CAAC,IAAI,IAAI,IAAIwB,qBAAqB,CAAC,CAAC,KAAK;AAC7D,CAAC;AAED,eAAeY,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/auth-plugins",
|
|
3
|
-
"version": "0.67.1-beta.
|
|
3
|
+
"version": "0.67.1-beta.1+1ce6aac8",
|
|
4
4
|
"description": "Deephaven Auth Plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Deephaven",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@deephaven/components": "^0.67.1-beta.
|
|
37
|
-
"@deephaven/jsapi-bootstrap": "^0.67.1-beta.
|
|
38
|
-
"@deephaven/jsapi-components": "^0.67.1-beta.
|
|
39
|
-
"@deephaven/jsapi-types": "
|
|
40
|
-
"@deephaven/jsapi-utils": "^0.67.1-beta.
|
|
41
|
-
"@deephaven/log": "^0.67.1-beta.
|
|
42
|
-
"@deephaven/redux": "^0.67.1-beta.
|
|
43
|
-
"@deephaven/utils": "^0.67.1-beta.
|
|
36
|
+
"@deephaven/components": "^0.67.1-beta.1+1ce6aac8",
|
|
37
|
+
"@deephaven/jsapi-bootstrap": "^0.67.1-beta.1+1ce6aac8",
|
|
38
|
+
"@deephaven/jsapi-components": "^0.67.1-beta.1+1ce6aac8",
|
|
39
|
+
"@deephaven/jsapi-types": "1.0.0-dev0.33.1",
|
|
40
|
+
"@deephaven/jsapi-utils": "^0.67.1-beta.1+1ce6aac8",
|
|
41
|
+
"@deephaven/log": "^0.67.1-beta.1+1ce6aac8",
|
|
42
|
+
"@deephaven/redux": "^0.67.1-beta.1+1ce6aac8",
|
|
43
|
+
"@deephaven/utils": "^0.67.1-beta.1+1ce6aac8",
|
|
44
44
|
"classnames": "^2.3.1",
|
|
45
45
|
"js-cookie": "^3.0.5",
|
|
46
46
|
"react-transition-group": "^4.4.2"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1ce6aac82071303fdbed064e8b71b54f741d0a87"
|
|
63
63
|
}
|