@jbrowse/plugin-authentication 5.0.0-beta.13 → 5.0.0-beta.14
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/esm/DropboxOAuthModel/DropboxIcon.d.ts +2 -1
- package/esm/DropboxOAuthModel/DropboxIcon.js +4 -2
- package/esm/DropboxOAuthModel/configSchema.d.ts +2 -0
- package/esm/DropboxOAuthModel/configSchema.js +2 -0
- package/esm/DropboxOAuthModel/model.d.ts +2 -0
- package/esm/DropboxOAuthModel/model.js +2 -0
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +3 -2
- package/esm/ExternalTokenModel/configSchema.d.ts +2 -0
- package/esm/ExternalTokenModel/configSchema.js +2 -0
- package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +2 -1
- package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.js +4 -2
- package/esm/GoogleDriveOAuthModel/configSchema.d.ts +2 -0
- package/esm/GoogleDriveOAuthModel/configSchema.js +2 -0
- package/esm/GoogleDriveOAuthModel/model.d.ts +2 -0
- package/esm/GoogleDriveOAuthModel/model.js +2 -0
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +2 -2
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +3 -2
- package/esm/HTTPBasicModel/configSchema.d.ts +2 -0
- package/esm/HTTPBasicModel/configSchema.js +2 -0
- package/esm/OAuthModel/OAuthLoginPrompt.d.ts +2 -2
- package/esm/OAuthModel/OAuthLoginPrompt.js +3 -2
- package/esm/OAuthModel/configSchema.d.ts +2 -0
- package/esm/OAuthModel/configSchema.js +2 -0
- package/esm/OAuthModel/model.d.ts +2 -0
- package/esm/OAuthModel/model.js +2 -0
- package/esm/lazyLoginForms.d.ts +12 -3
- package/package.json +6 -5
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SvgIcon } from '@mui/material';
|
|
3
|
-
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
const DropboxIcon = observer(function DropboxIcon(props) {
|
|
4
5
|
return (_jsx(SvgIcon, { ...props, children: _jsx("path", { d: "M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z" }) }));
|
|
5
|
-
}
|
|
6
|
+
});
|
|
7
|
+
export default DropboxIcon;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
/**
|
|
3
3
|
* #config DropboxOAuthInternetAccount
|
|
4
|
+
* Signs requests for Dropbox files with an OAuth 2.0 token, with the Dropbox
|
|
5
|
+
* endpoints and domains filled in.
|
|
4
6
|
*
|
|
5
7
|
* #example
|
|
6
8
|
* The Dropbox endpoints are pre-filled, so an entry needs only your own OAuth
|
|
@@ -2,6 +2,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
import OAuthConfigSchema from '../OAuthModel/configSchema.js';
|
|
3
3
|
/**
|
|
4
4
|
* #config DropboxOAuthInternetAccount
|
|
5
|
+
* Signs requests for Dropbox files with an OAuth 2.0 token, with the Dropbox
|
|
6
|
+
* endpoints and domains filled in.
|
|
5
7
|
*
|
|
6
8
|
* #example
|
|
7
9
|
* The Dropbox endpoints are pre-filled, so an entry needs only your own OAuth
|
|
@@ -3,6 +3,8 @@ import type { UriLocation } from '@jbrowse/core/util/types';
|
|
|
3
3
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
4
4
|
/**
|
|
5
5
|
* #stateModel DropboxOAuthInternetAccount
|
|
6
|
+
* Fetches a file from a Dropbox share link through the Dropbox API, with an
|
|
7
|
+
* OAuth 2.0 token from the Dropbox login.
|
|
6
8
|
*/
|
|
7
9
|
declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<Omit<Omit<{
|
|
8
10
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
@@ -7,6 +7,8 @@ import DropboxIcon from './DropboxIcon.js';
|
|
|
7
7
|
import { getDescriptiveErrorMessage } from './util.js';
|
|
8
8
|
/**
|
|
9
9
|
* #stateModel DropboxOAuthInternetAccount
|
|
10
|
+
* Fetches a file from a Dropbox share link through the Dropbox API, with an
|
|
11
|
+
* OAuth 2.0 token from the Dropbox login.
|
|
10
12
|
*/
|
|
11
13
|
const stateModelFactory = (configSchema) => {
|
|
12
14
|
return baseModel(OAuthConfigSchema)
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { SubmitDialog } from '@jbrowse/core/ui';
|
|
4
4
|
import { TextField } from '@mui/material';
|
|
5
|
-
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
6
|
+
export const ExternalTokenEntryForm = observer(function ExternalTokenEntryForm({ internetAccountId, handleClose, }) {
|
|
6
7
|
const [token, setToken] = useState('');
|
|
7
8
|
return (_jsx(SubmitDialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", title: `Enter token for ${internetAccountId}`, submitText: "Add", submitDisabled: !token, onCancel: () => {
|
|
8
9
|
handleClose();
|
|
@@ -13,4 +14,4 @@ export const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
|
|
|
13
14
|
}, margin: "dense", slotProps: {
|
|
14
15
|
htmlInput: { 'data-testid': 'entry-externalToken' },
|
|
15
16
|
} }) }));
|
|
16
|
-
};
|
|
17
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
/**
|
|
3
3
|
* #config ExternalTokenInternetAccount
|
|
4
|
+
* Sends a token that the user pastes in, or that an embedding portal supplies,
|
|
5
|
+
* with every request to a matching domain.
|
|
4
6
|
*
|
|
5
7
|
* #example
|
|
6
8
|
* For a token the user pastes in, or that an embedding portal hands over.
|
|
@@ -2,6 +2,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
/**
|
|
4
4
|
* #config ExternalTokenInternetAccount
|
|
5
|
+
* Sends a token that the user pastes in, or that an embedding portal supplies,
|
|
6
|
+
* with every request to a matching domain.
|
|
5
7
|
*
|
|
6
8
|
* #example
|
|
7
9
|
* For a token the user pastes in, or that an embedding portal hands over.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SvgIcon } from '@mui/material';
|
|
3
|
-
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
const GoogleDriveIcon = observer(function GoogleDriveIcon(props) {
|
|
4
5
|
return (_jsx(SvgIcon, { ...props, children: _jsx("path", { d: "M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z" }) }));
|
|
5
|
-
}
|
|
6
|
+
});
|
|
7
|
+
export default GoogleDriveIcon;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
/**
|
|
3
3
|
* #config GoogleDriveOAuthInternetAccount
|
|
4
|
+
* Signs requests for Google Drive files with an OAuth 2.0 token, with the
|
|
5
|
+
* Google endpoints, read-only Drive scope and domain filled in.
|
|
4
6
|
*
|
|
5
7
|
* #example
|
|
6
8
|
* The Google endpoints and scopes are pre-filled, so an entry needs only your
|
|
@@ -2,6 +2,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
import OAuthConfigSchema from '../OAuthModel/configSchema.js';
|
|
3
3
|
/**
|
|
4
4
|
* #config GoogleDriveOAuthInternetAccount
|
|
5
|
+
* Signs requests for Google Drive files with an OAuth 2.0 token, with the
|
|
6
|
+
* Google endpoints, read-only Drive scope and domain filled in.
|
|
5
7
|
*
|
|
6
8
|
* #example
|
|
7
9
|
* The Google endpoints and scopes are pre-filled, so an entry needs only your
|
|
@@ -7,6 +7,8 @@ export interface RequestInitWithMetadata extends RequestInit {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* #stateModel GoogleDriveOAuthInternetAccount
|
|
10
|
+
* Fetches a file from a Google Drive share link through the Drive API, with an
|
|
11
|
+
* OAuth 2.0 token from the Google login.
|
|
10
12
|
*/
|
|
11
13
|
export default function stateModelFactory(configSchema: GoogleDriveOAuthInternetAccountConfigModel): import("@jbrowse/mobx-state-tree").IModelType<Omit<Omit<{
|
|
12
14
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
@@ -15,6 +15,8 @@ function getUri(str) {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* #stateModel GoogleDriveOAuthInternetAccount
|
|
18
|
+
* Fetches a file from a Google Drive share link through the Drive API, with an
|
|
19
|
+
* OAuth 2.0 token from the Google login.
|
|
18
20
|
*/
|
|
19
21
|
export default function stateModelFactory(configSchema) {
|
|
20
22
|
return baseModel(OAuthConfigSchema)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const HTTPBasicLoginForm: ({ internetAccountId, handleClose, }: {
|
|
2
2
|
internetAccountId: string;
|
|
3
3
|
handleClose: (arg?: string) => void;
|
|
4
|
-
})
|
|
4
|
+
}) => import("react").JSX.Element;
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { SubmitDialog } from '@jbrowse/core/ui';
|
|
4
4
|
import { TextField } from '@mui/material';
|
|
5
|
-
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
6
|
+
export const HTTPBasicLoginForm = observer(function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
|
|
6
7
|
const [username, setUsername] = useState('');
|
|
7
8
|
const [password, setPassword] = useState('');
|
|
8
9
|
return (_jsx(SubmitDialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`,
|
|
@@ -21,4 +22,4 @@ export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
|
|
|
21
22
|
}, margin: "dense", slotProps: {
|
|
22
23
|
htmlInput: { 'data-testid': 'login-httpbasic-password' },
|
|
23
24
|
} })] }) }));
|
|
24
|
-
}
|
|
25
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
/**
|
|
3
3
|
* #config HTTPBasicInternetAccount
|
|
4
|
+
* Prompts for a username and password, and sends them in an HTTP Basic
|
|
5
|
+
* `Authorization` header on requests to a matching domain.
|
|
4
6
|
*
|
|
5
7
|
* #example
|
|
6
8
|
* An entry in the config's `internetAccounts`. JBrowse prompts for the username
|
|
@@ -2,6 +2,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
/**
|
|
4
4
|
* #config HTTPBasicInternetAccount
|
|
5
|
+
* Prompts for a username and password, and sends them in an HTTP Basic
|
|
6
|
+
* `Authorization` header on requests to a matching domain.
|
|
5
7
|
*
|
|
6
8
|
* #example
|
|
7
9
|
* An entry in the config's `internetAccounts`. JBrowse prompts for the username
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const OAuthLoginPrompt: ({ internetAccountId, handleClose, }: {
|
|
2
2
|
internetAccountId: string;
|
|
3
3
|
handleClose: (proceed: boolean) => void;
|
|
4
|
-
})
|
|
4
|
+
}) => import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Dialog } from '@jbrowse/core/ui';
|
|
3
3
|
import { Button, DialogActions, DialogContent, Typography } from '@mui/material';
|
|
4
|
-
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
export const OAuthLoginPrompt = observer(function OAuthLoginPrompt({ internetAccountId, handleClose, }) {
|
|
5
6
|
return (_jsxs(Dialog, { open: true, maxWidth: "xs", "data-testid": "oauth-login-prompt", title: `Log in to ${internetAccountId}`, onClose: () => {
|
|
6
7
|
handleClose(false);
|
|
7
8
|
}, children: [_jsx(DialogContent, { children: _jsxs(Typography, { children: ["This session has a track that needs you to log in to", ' ', internetAccountId, ". Browsers only allow the login window to open from a click, so it could not be opened on your behalf."] }) }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "secondary", variant: "contained", onClick: () => {
|
|
@@ -9,4 +10,4 @@ export function OAuthLoginPrompt({ internetAccountId, handleClose, }) {
|
|
|
9
10
|
}, children: "Cancel" }), _jsx(Button, { color: "primary", variant: "contained", onClick: () => {
|
|
10
11
|
handleClose(true);
|
|
11
12
|
}, children: "Log in" })] })] }));
|
|
12
|
-
}
|
|
13
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
/**
|
|
3
3
|
* #config OAuthInternetAccount
|
|
4
|
+
* Signs requests to a resource that uses OAuth 2.0, fetching and refreshing
|
|
5
|
+
* the access token through the provider's authorization flow.
|
|
4
6
|
*/
|
|
5
7
|
declare const OAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
6
8
|
authEndpoint: {
|
|
@@ -2,6 +2,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
/**
|
|
4
4
|
* #config OAuthInternetAccount
|
|
5
|
+
* Signs requests to a resource that uses OAuth 2.0, fetching and refreshing
|
|
6
|
+
* the access token through the provider's authorization flow.
|
|
5
7
|
*/
|
|
6
8
|
const OAuthConfigSchema = ConfigurationSchema('OAuthInternetAccount', {
|
|
7
9
|
/**
|
|
@@ -3,6 +3,8 @@ import type { UriLocation } from '@jbrowse/core/util';
|
|
|
3
3
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
4
4
|
/**
|
|
5
5
|
* #stateModel OAuthInternetAccount
|
|
6
|
+
* Gets an OAuth 2.0 access token from the provider's login window, and renews
|
|
7
|
+
* it with a refresh token kept in `localStorage`.
|
|
6
8
|
*/
|
|
7
9
|
declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<Omit<{
|
|
8
10
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
package/esm/OAuthModel/model.js
CHANGED
|
@@ -51,6 +51,8 @@ function promptForLoginWindow({ internetAccountId, session, openLoginWindow, wai
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* #stateModel OAuthInternetAccount
|
|
54
|
+
* Gets an OAuth 2.0 access token from the provider's login window, and renews
|
|
55
|
+
* it with a refresh token kept in `localStorage`.
|
|
54
56
|
*/
|
|
55
57
|
const stateModelFactory = (configSchema) => {
|
|
56
58
|
return InternetAccount.named('OAuthInternetAccount')
|
package/esm/lazyLoginForms.d.ts
CHANGED
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
* site. All are named exports, hence the `.then` — `lazy` wants a module
|
|
14
14
|
* with a `default`.
|
|
15
15
|
*/
|
|
16
|
-
export declare const HTTPBasicLoginForm: import("react").LazyExoticComponent<
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export declare const HTTPBasicLoginForm: import("react").LazyExoticComponent<({ internetAccountId, handleClose, }: {
|
|
17
|
+
internetAccountId: string;
|
|
18
|
+
handleClose: (arg?: string) => void;
|
|
19
|
+
}) => import("react").JSX.Element>;
|
|
20
|
+
export declare const ExternalTokenEntryForm: import("react").LazyExoticComponent<({ internetAccountId, handleClose, }: {
|
|
21
|
+
internetAccountId: string;
|
|
22
|
+
handleClose: (token?: string) => void;
|
|
23
|
+
}) => import("react").JSX.Element>;
|
|
24
|
+
export declare const OAuthLoginPrompt: import("react").LazyExoticComponent<({ internetAccountId, handleClose, }: {
|
|
25
|
+
internetAccountId: string;
|
|
26
|
+
handleClose: (proceed: boolean) => void;
|
|
27
|
+
}) => import("react").JSX.Element>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-authentication",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 Authentication",
|
|
6
6
|
"keywords": [
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jbrowse/mobx-state-tree": "^6.
|
|
25
|
-
"@mui/material": "^9.
|
|
26
|
-
"generic-filehandle2": "^2.5.
|
|
24
|
+
"@jbrowse/mobx-state-tree": "^6.9.0",
|
|
25
|
+
"@mui/material": "^9.5.0",
|
|
26
|
+
"generic-filehandle2": "^2.5.1",
|
|
27
27
|
"mobx": "^7.0.6",
|
|
28
|
-
"
|
|
28
|
+
"mobx-react": "^10.0.2",
|
|
29
|
+
"@jbrowse/core": "^5.0.0-beta.14"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": ">=19.0.0",
|