@jbrowse/plugin-authentication 4.3.0 → 5.0.0-beta.10
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 +1 -1
- package/esm/DropboxOAuthModel/configSchema.d.ts +154 -48
- package/esm/DropboxOAuthModel/configSchema.js +32 -2
- package/esm/DropboxOAuthModel/index.js +2 -2
- package/esm/DropboxOAuthModel/model.d.ts +301 -127
- package/esm/DropboxOAuthModel/model.js +46 -21
- package/esm/DropboxOAuthModel/util.d.ts +1 -1
- package/esm/DropboxOAuthModel/util.js +9 -12
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -1
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +11 -15
- package/esm/ExternalTokenModel/configSchema.d.ts +80 -19
- package/esm/ExternalTokenModel/configSchema.js +22 -1
- package/esm/ExternalTokenModel/index.js +2 -2
- package/esm/ExternalTokenModel/model.d.ts +49 -63
- package/esm/ExternalTokenModel/model.js +11 -54
- package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +2 -9
- package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +27 -6
- package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/configSchema.d.ts +152 -47
- package/esm/GoogleDriveOAuthModel/configSchema.js +32 -3
- package/esm/GoogleDriveOAuthModel/index.js +2 -2
- package/esm/GoogleDriveOAuthModel/model.d.ts +296 -128
- package/esm/GoogleDriveOAuthModel/model.js +45 -22
- package/esm/GoogleDriveOAuthModel/util.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/util.js +2 -11
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -1
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +17 -22
- package/esm/HTTPBasicModel/configSchema.d.ts +78 -21
- package/esm/HTTPBasicModel/configSchema.js +26 -1
- package/esm/HTTPBasicModel/index.js +2 -2
- package/esm/HTTPBasicModel/model.d.ts +57 -68
- package/esm/HTTPBasicModel/model.js +21 -51
- package/esm/OAuthModel/OAuthLoginPrompt.d.ts +4 -0
- package/esm/OAuthModel/OAuthLoginPrompt.js +12 -0
- package/esm/OAuthModel/configSchema.d.ts +81 -38
- package/esm/OAuthModel/configSchema.js +30 -1
- package/esm/OAuthModel/index.js +2 -2
- package/esm/OAuthModel/model.d.ts +231 -77
- package/esm/OAuthModel/model.js +361 -217
- package/esm/OAuthModel/util.d.ts +46 -7
- package/esm/OAuthModel/util.js +159 -16
- package/esm/index.d.ts +0 -1020
- package/esm/index.js +24 -57
- package/esm/lazyLoginForms.d.ts +18 -0
- package/esm/lazyLoginForms.js +25 -0
- package/esm/tokenEntryModelFactory.d.ts +135 -0
- package/esm/tokenEntryModelFactory.js +85 -0
- package/esm/util.d.ts +10 -0
- package/esm/util.js +24 -2
- package/package.json +10 -13
|
@@ -1,72 +1,115 @@
|
|
|
1
1
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
|
+
/**
|
|
3
|
+
* #config OAuthInternetAccount
|
|
4
|
+
*/
|
|
2
5
|
declare const OAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
authEndpoint: {
|
|
7
|
+
type: "string";
|
|
8
|
+
} & {
|
|
6
9
|
defaultValue: string;
|
|
7
10
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
authHeader: {
|
|
12
|
+
type: "string";
|
|
13
|
+
} & {
|
|
11
14
|
defaultValue: string;
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
clientId: {
|
|
17
|
+
type: "string";
|
|
18
|
+
} & {
|
|
19
|
+
defaultValue: string;
|
|
20
|
+
};
|
|
21
|
+
description: {
|
|
22
|
+
type: "string";
|
|
23
|
+
} & {
|
|
24
|
+
defaultValue: string;
|
|
25
|
+
};
|
|
26
|
+
domains: {
|
|
27
|
+
type: "stringArray";
|
|
28
|
+
} & {
|
|
29
|
+
defaultValue: unknown;
|
|
30
|
+
};
|
|
31
|
+
internetAccountId: {
|
|
32
|
+
type: "string";
|
|
33
|
+
} & {
|
|
34
|
+
defaultValue: string;
|
|
35
|
+
};
|
|
36
|
+
name: {
|
|
37
|
+
type: "string";
|
|
38
|
+
} & {
|
|
16
39
|
defaultValue: string;
|
|
17
40
|
};
|
|
18
41
|
needsPKCE: {
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
type: "boolean";
|
|
43
|
+
} & {
|
|
21
44
|
defaultValue: boolean;
|
|
22
45
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
responseType: {
|
|
47
|
+
type: "string";
|
|
48
|
+
} & {
|
|
26
49
|
defaultValue: string;
|
|
27
50
|
};
|
|
28
51
|
scopes: {
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
type: "string";
|
|
53
|
+
} & {
|
|
31
54
|
defaultValue: string;
|
|
32
55
|
};
|
|
33
56
|
state: {
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
type: "string";
|
|
58
|
+
} & {
|
|
36
59
|
defaultValue: string;
|
|
37
60
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
61
|
+
tokenEndpoint: {
|
|
62
|
+
type: "string";
|
|
63
|
+
} & {
|
|
64
|
+
defaultValue: string;
|
|
65
|
+
};
|
|
66
|
+
tokenType: {
|
|
67
|
+
type: "string";
|
|
68
|
+
} & {
|
|
69
|
+
defaultValue: string;
|
|
70
|
+
};
|
|
71
|
+
type: {
|
|
72
|
+
type: "string";
|
|
73
|
+
} & {
|
|
41
74
|
defaultValue: string;
|
|
42
75
|
};
|
|
43
76
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
44
|
-
name: {
|
|
45
|
-
|
|
46
|
-
|
|
77
|
+
readonly name: {
|
|
78
|
+
type: "string";
|
|
79
|
+
} & {
|
|
47
80
|
defaultValue: string;
|
|
48
81
|
};
|
|
49
|
-
description: {
|
|
50
|
-
|
|
51
|
-
|
|
82
|
+
readonly description: {
|
|
83
|
+
type: "string";
|
|
84
|
+
} & {
|
|
52
85
|
defaultValue: string;
|
|
53
86
|
};
|
|
54
|
-
authHeader: {
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
readonly authHeader: {
|
|
88
|
+
type: "string";
|
|
89
|
+
} & {
|
|
57
90
|
defaultValue: string;
|
|
58
91
|
};
|
|
59
|
-
tokenType: {
|
|
60
|
-
|
|
61
|
-
|
|
92
|
+
readonly tokenType: {
|
|
93
|
+
type: "string";
|
|
94
|
+
} & {
|
|
62
95
|
defaultValue: string;
|
|
63
96
|
};
|
|
64
|
-
domains: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
defaultValue:
|
|
97
|
+
readonly domains: {
|
|
98
|
+
type: "stringArray";
|
|
99
|
+
} & {
|
|
100
|
+
defaultValue: unknown;
|
|
101
|
+
};
|
|
102
|
+
type: {
|
|
103
|
+
type: "string";
|
|
104
|
+
} & {
|
|
105
|
+
defaultValue: string;
|
|
106
|
+
};
|
|
107
|
+
internetAccountId: {
|
|
108
|
+
type: "string";
|
|
109
|
+
} & {
|
|
110
|
+
defaultValue: string;
|
|
68
111
|
};
|
|
69
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
|
|
112
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
70
113
|
export type OAuthInternetAccountConfigModel = typeof OAuthConfigSchema;
|
|
71
114
|
export type OAuthInternetAccountConfig = Instance<OAuthInternetAccountConfigModel>;
|
|
72
115
|
export default OAuthConfigSchema;
|
|
@@ -1,48 +1,77 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* #config OAuthInternetAccount
|
|
5
|
+
*/
|
|
4
6
|
const OAuthConfigSchema = ConfigurationSchema('OAuthInternetAccount', {
|
|
7
|
+
/**
|
|
8
|
+
* #slot
|
|
9
|
+
*/
|
|
5
10
|
tokenType: {
|
|
6
11
|
description: 'a custom name for a token to include in the header',
|
|
7
12
|
type: 'string',
|
|
8
13
|
defaultValue: 'Bearer',
|
|
9
14
|
},
|
|
15
|
+
/**
|
|
16
|
+
* #slot
|
|
17
|
+
*/
|
|
10
18
|
authEndpoint: {
|
|
11
19
|
description: 'the authorization code endpoint of the internet account',
|
|
12
20
|
type: 'string',
|
|
13
21
|
defaultValue: '',
|
|
14
22
|
},
|
|
23
|
+
/**
|
|
24
|
+
* #slot
|
|
25
|
+
*/
|
|
15
26
|
tokenEndpoint: {
|
|
16
27
|
description: 'the token endpoint of the internet account',
|
|
17
28
|
type: 'string',
|
|
18
29
|
defaultValue: '',
|
|
19
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* #slot
|
|
33
|
+
*/
|
|
20
34
|
needsPKCE: {
|
|
21
35
|
description: 'boolean to indicate if the endpoint needs a PKCE code',
|
|
22
36
|
type: 'boolean',
|
|
23
37
|
defaultValue: false,
|
|
24
38
|
},
|
|
39
|
+
/**
|
|
40
|
+
* #slot
|
|
41
|
+
*/
|
|
25
42
|
clientId: {
|
|
26
43
|
description: 'id for the OAuth application',
|
|
27
44
|
type: 'string',
|
|
28
45
|
defaultValue: '',
|
|
29
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* #slot
|
|
49
|
+
*/
|
|
30
50
|
scopes: {
|
|
31
51
|
description: 'optional scopes for the authorization call',
|
|
32
52
|
type: 'string',
|
|
33
53
|
defaultValue: '',
|
|
34
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* #slot
|
|
57
|
+
*/
|
|
35
58
|
state: {
|
|
36
59
|
description: 'optional state for the authorization call',
|
|
37
60
|
type: 'string',
|
|
38
61
|
defaultValue: '',
|
|
39
62
|
},
|
|
63
|
+
/**
|
|
64
|
+
* #slot
|
|
65
|
+
*/
|
|
40
66
|
responseType: {
|
|
41
67
|
description: "the type of response from the authorization endpoint. can be 'token' or 'code'",
|
|
42
68
|
type: 'string',
|
|
43
69
|
defaultValue: 'code',
|
|
44
70
|
},
|
|
45
71
|
}, {
|
|
72
|
+
/**
|
|
73
|
+
* #baseConfiguration
|
|
74
|
+
*/
|
|
46
75
|
baseConfiguration: BaseInternetAccountConfig,
|
|
47
76
|
explicitlyTyped: true,
|
|
48
77
|
});
|
package/esm/OAuthModel/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as configSchema } from
|
|
2
|
-
export { default as modelFactory } from
|
|
1
|
+
export { default as configSchema } from './configSchema.js';
|
|
2
|
+
export { default as modelFactory } from './model.js';
|
|
@@ -1,106 +1,165 @@
|
|
|
1
|
-
import type { OAuthInternetAccountConfigModel } from './configSchema.ts';
|
|
1
|
+
import type { OAuthInternetAccountConfig, OAuthInternetAccountConfigModel } from './configSchema.ts';
|
|
2
2
|
import type { UriLocation } from '@jbrowse/core/util';
|
|
3
3
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* #stateModel OAuthInternetAccount
|
|
6
|
+
*/
|
|
7
|
+
declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<Omit<{
|
|
5
8
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
6
9
|
type: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
7
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
8
|
-
name: {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
11
|
+
readonly name: {
|
|
12
|
+
type: "string";
|
|
13
|
+
} & {
|
|
11
14
|
defaultValue: string;
|
|
12
15
|
};
|
|
13
|
-
description: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
readonly description: {
|
|
17
|
+
type: "string";
|
|
18
|
+
} & {
|
|
16
19
|
defaultValue: string;
|
|
17
20
|
};
|
|
18
|
-
authHeader: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
readonly authHeader: {
|
|
22
|
+
type: "string";
|
|
23
|
+
} & {
|
|
21
24
|
defaultValue: string;
|
|
22
25
|
};
|
|
23
|
-
tokenType: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
readonly tokenType: {
|
|
27
|
+
type: "string";
|
|
28
|
+
} & {
|
|
26
29
|
defaultValue: string;
|
|
27
30
|
};
|
|
28
|
-
domains: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
defaultValue:
|
|
31
|
+
readonly domains: {
|
|
32
|
+
type: "stringArray";
|
|
33
|
+
} & {
|
|
34
|
+
defaultValue: unknown;
|
|
32
35
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
37
|
-
tokenType: {
|
|
38
|
-
description: string;
|
|
39
|
-
type: string;
|
|
36
|
+
type: {
|
|
37
|
+
type: "string";
|
|
38
|
+
} & {
|
|
40
39
|
defaultValue: string;
|
|
41
40
|
};
|
|
41
|
+
internetAccountId: {
|
|
42
|
+
type: "string";
|
|
43
|
+
} & {
|
|
44
|
+
defaultValue: string;
|
|
45
|
+
};
|
|
46
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
47
|
+
}, "configuration" | "type"> & {
|
|
48
|
+
/**
|
|
49
|
+
* #property
|
|
50
|
+
*/
|
|
51
|
+
type: import("@jbrowse/mobx-state-tree").ILiteralType<"OAuthInternetAccount">;
|
|
52
|
+
/**
|
|
53
|
+
* #property
|
|
54
|
+
*/
|
|
55
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
42
56
|
authEndpoint: {
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
type: "string";
|
|
58
|
+
} & {
|
|
45
59
|
defaultValue: string;
|
|
46
60
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
authHeader: {
|
|
62
|
+
type: "string";
|
|
63
|
+
} & {
|
|
64
|
+
defaultValue: string;
|
|
65
|
+
};
|
|
66
|
+
clientId: {
|
|
67
|
+
type: "string";
|
|
68
|
+
} & {
|
|
69
|
+
defaultValue: string;
|
|
70
|
+
};
|
|
71
|
+
description: {
|
|
72
|
+
type: "string";
|
|
73
|
+
} & {
|
|
74
|
+
defaultValue: string;
|
|
75
|
+
};
|
|
76
|
+
domains: {
|
|
77
|
+
type: "stringArray";
|
|
78
|
+
} & {
|
|
79
|
+
defaultValue: unknown;
|
|
80
|
+
};
|
|
81
|
+
internetAccountId: {
|
|
82
|
+
type: "string";
|
|
83
|
+
} & {
|
|
84
|
+
defaultValue: string;
|
|
85
|
+
};
|
|
86
|
+
name: {
|
|
87
|
+
type: "string";
|
|
88
|
+
} & {
|
|
50
89
|
defaultValue: string;
|
|
51
90
|
};
|
|
52
91
|
needsPKCE: {
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
type: "boolean";
|
|
93
|
+
} & {
|
|
55
94
|
defaultValue: boolean;
|
|
56
95
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
96
|
+
responseType: {
|
|
97
|
+
type: "string";
|
|
98
|
+
} & {
|
|
60
99
|
defaultValue: string;
|
|
61
100
|
};
|
|
62
101
|
scopes: {
|
|
63
|
-
|
|
64
|
-
|
|
102
|
+
type: "string";
|
|
103
|
+
} & {
|
|
65
104
|
defaultValue: string;
|
|
66
105
|
};
|
|
67
106
|
state: {
|
|
68
|
-
|
|
69
|
-
|
|
107
|
+
type: "string";
|
|
108
|
+
} & {
|
|
70
109
|
defaultValue: string;
|
|
71
110
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
111
|
+
tokenEndpoint: {
|
|
112
|
+
type: "string";
|
|
113
|
+
} & {
|
|
114
|
+
defaultValue: string;
|
|
115
|
+
};
|
|
116
|
+
tokenType: {
|
|
117
|
+
type: "string";
|
|
118
|
+
} & {
|
|
119
|
+
defaultValue: string;
|
|
120
|
+
};
|
|
121
|
+
type: {
|
|
122
|
+
type: "string";
|
|
123
|
+
} & {
|
|
75
124
|
defaultValue: string;
|
|
76
125
|
};
|
|
77
126
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
78
|
-
name: {
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
readonly name: {
|
|
128
|
+
type: "string";
|
|
129
|
+
} & {
|
|
81
130
|
defaultValue: string;
|
|
82
131
|
};
|
|
83
|
-
description: {
|
|
84
|
-
|
|
85
|
-
|
|
132
|
+
readonly description: {
|
|
133
|
+
type: "string";
|
|
134
|
+
} & {
|
|
86
135
|
defaultValue: string;
|
|
87
136
|
};
|
|
88
|
-
authHeader: {
|
|
89
|
-
|
|
90
|
-
|
|
137
|
+
readonly authHeader: {
|
|
138
|
+
type: "string";
|
|
139
|
+
} & {
|
|
91
140
|
defaultValue: string;
|
|
92
141
|
};
|
|
93
|
-
tokenType: {
|
|
94
|
-
|
|
95
|
-
|
|
142
|
+
readonly tokenType: {
|
|
143
|
+
type: "string";
|
|
144
|
+
} & {
|
|
96
145
|
defaultValue: string;
|
|
97
146
|
};
|
|
98
|
-
domains: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
defaultValue:
|
|
147
|
+
readonly domains: {
|
|
148
|
+
type: "stringArray";
|
|
149
|
+
} & {
|
|
150
|
+
defaultValue: unknown;
|
|
102
151
|
};
|
|
103
|
-
|
|
152
|
+
type: {
|
|
153
|
+
type: "string";
|
|
154
|
+
} & {
|
|
155
|
+
defaultValue: string;
|
|
156
|
+
};
|
|
157
|
+
internetAccountId: {
|
|
158
|
+
type: "string";
|
|
159
|
+
} & {
|
|
160
|
+
defaultValue: string;
|
|
161
|
+
};
|
|
162
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
104
163
|
}, {
|
|
105
164
|
readonly name: string;
|
|
106
165
|
readonly description: string;
|
|
@@ -109,22 +168,21 @@ declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel)
|
|
|
109
168
|
readonly tokenType: string;
|
|
110
169
|
readonly domains: string[];
|
|
111
170
|
readonly toggleContents: React.ReactNode;
|
|
112
|
-
readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
|
|
113
171
|
readonly selectorLabel: string | undefined;
|
|
172
|
+
readonly showInFileSelector: boolean;
|
|
114
173
|
} & {
|
|
115
174
|
handlesLocation(location: UriLocation): boolean;
|
|
116
175
|
readonly tokenKey: string;
|
|
117
176
|
} & {
|
|
118
177
|
getTokenFromUser(_resolve: (token: string) => void, _reject: (error: Error) => void): void;
|
|
119
178
|
storeToken(token: string): void;
|
|
120
|
-
|
|
121
|
-
retrieveToken(): string | null;
|
|
179
|
+
retrieveToken(): string | undefined;
|
|
122
180
|
validateToken(token: string, _loc: UriLocation): Promise<string>;
|
|
123
181
|
} & {
|
|
182
|
+
removeToken(): void;
|
|
124
183
|
getToken(location?: UriLocation): Promise<string>;
|
|
125
184
|
} & {
|
|
126
185
|
addAuthHeaderToInit(init?: RequestInit, token?: string): {
|
|
127
|
-
headers: Headers;
|
|
128
186
|
body?: BodyInit | null;
|
|
129
187
|
cache?: RequestCache;
|
|
130
188
|
credentials?: RequestCredentials;
|
|
@@ -138,44 +196,140 @@ declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel)
|
|
|
138
196
|
referrerPolicy?: ReferrerPolicy;
|
|
139
197
|
signal?: AbortSignal | null;
|
|
140
198
|
window?: null;
|
|
199
|
+
headers: Headers;
|
|
141
200
|
};
|
|
201
|
+
fetchWithToken(loc: UriLocation | undefined, run: (token: string) => Promise<Response>): Promise<Response>;
|
|
142
202
|
getPreAuthorizationInformation(location: UriLocation): Promise<{
|
|
143
203
|
internetAccountType: string;
|
|
144
204
|
authInfo: {
|
|
145
205
|
token: string;
|
|
146
|
-
configuration: any
|
|
206
|
+
configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
|
|
147
207
|
};
|
|
148
208
|
}>;
|
|
149
209
|
} & {
|
|
150
210
|
getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
151
211
|
} & {
|
|
152
|
-
openLocation(location: UriLocation): import("@
|
|
212
|
+
openLocation(location: UriLocation): import("@gmod/range-cache-filehandle").RemoteFileWithRangeCache;
|
|
153
213
|
} & {
|
|
154
|
-
|
|
214
|
+
/**
|
|
215
|
+
* #getter
|
|
216
|
+
* The config typed off the concrete schema. `ConfigurationReference`
|
|
217
|
+
* erases `self.configuration` to `any` (the reference's MST instance brand
|
|
218
|
+
* doesn't carry the schema's slot definitions), so reads go through this
|
|
219
|
+
* getter to recover per-slot types and slot-name validation.
|
|
220
|
+
*/
|
|
221
|
+
readonly conf: OAuthInternetAccountConfig;
|
|
155
222
|
} & {
|
|
223
|
+
/**
|
|
224
|
+
* #getter
|
|
225
|
+
*/
|
|
156
226
|
readonly authEndpoint: string;
|
|
227
|
+
/**
|
|
228
|
+
* #getter
|
|
229
|
+
*/
|
|
157
230
|
readonly tokenEndpoint: string;
|
|
231
|
+
/**
|
|
232
|
+
* #getter
|
|
233
|
+
*/
|
|
158
234
|
readonly needsPKCE: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* #getter
|
|
237
|
+
*/
|
|
159
238
|
readonly clientId: string;
|
|
239
|
+
/**
|
|
240
|
+
* #getter
|
|
241
|
+
*/
|
|
160
242
|
readonly scopes: string;
|
|
161
|
-
|
|
162
|
-
|
|
243
|
+
/**
|
|
244
|
+
* #getter
|
|
245
|
+
* OAuth state parameter:
|
|
246
|
+
* https://www.rfc-editor.org/rfc/rfc6749#section-4.1.1
|
|
247
|
+
*
|
|
248
|
+
* Can override or extend if dynamic state is needed.
|
|
249
|
+
*/
|
|
250
|
+
readonly state: string;
|
|
251
|
+
/**
|
|
252
|
+
* #getter
|
|
253
|
+
*/
|
|
254
|
+
readonly responseType: string;
|
|
255
|
+
/**
|
|
256
|
+
* #getter
|
|
257
|
+
*/
|
|
163
258
|
readonly refreshTokenKey: string;
|
|
259
|
+
/**
|
|
260
|
+
* #getter
|
|
261
|
+
* Extra parameters to add to the authorization request. Empty here;
|
|
262
|
+
* a provider that needs one of its own overrides this.
|
|
263
|
+
*/
|
|
264
|
+
readonly authFlowParams: Record<string, string>;
|
|
164
265
|
} & {
|
|
266
|
+
/**
|
|
267
|
+
* #action
|
|
268
|
+
*/
|
|
165
269
|
storeRefreshToken(refreshToken: string): void;
|
|
270
|
+
/**
|
|
271
|
+
* #action
|
|
272
|
+
*/
|
|
166
273
|
removeRefreshToken(): void;
|
|
167
|
-
|
|
168
|
-
|
|
274
|
+
/**
|
|
275
|
+
* #method
|
|
276
|
+
*/
|
|
277
|
+
retrieveRefreshToken(): string | undefined;
|
|
278
|
+
} & {
|
|
279
|
+
/**
|
|
280
|
+
* #action
|
|
281
|
+
* POST a grant to the token endpoint and read the access token out of the
|
|
282
|
+
* answer. Both grants this account makes — trading the authorization code
|
|
283
|
+
* on the way in, trading the refresh token when the access token expires
|
|
284
|
+
* — are the same form-encoded request to the same endpoint answered by
|
|
285
|
+
* the same body, and OAuth 2 says so (RFC 6749 §4.1.3, §6). They differ
|
|
286
|
+
* in the grant's own parameters and in what a failure means, which is
|
|
287
|
+
* what stays at the call sites.
|
|
288
|
+
*
|
|
289
|
+
* @param grant - the grant-specific parameters; `client_id` is added
|
|
290
|
+
* @param describeError - turns a failed exchange into a message, and is
|
|
291
|
+
* where a grant does whatever invalidating its failure implies
|
|
292
|
+
*/
|
|
293
|
+
postTokenGrant(grant: Record<string, string>, describeError: (response: Response) => Promise<string>): Promise<string>;
|
|
294
|
+
} & {
|
|
295
|
+
/**
|
|
296
|
+
* #action
|
|
297
|
+
*/
|
|
298
|
+
exchangeAuthorizationForAccessToken(code: string, redirectUri: string, codeVerifier: string | undefined): Promise<string>;
|
|
299
|
+
/**
|
|
300
|
+
* #action
|
|
301
|
+
*/
|
|
169
302
|
exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
|
|
170
303
|
} & {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
304
|
+
/**
|
|
305
|
+
* #action
|
|
306
|
+
* Prove a token against the resource and, if that fails, refresh it once
|
|
307
|
+
* and prove the new one. Returns whichever token worked; throws if
|
|
308
|
+
* neither does. Every OAuth account validates this way and they differ
|
|
309
|
+
* only in what a probe is — a HEAD of the resource here, a metadata call
|
|
310
|
+
* for Dropbox and Google Drive.
|
|
311
|
+
*
|
|
312
|
+
* @param token - the token to prove
|
|
313
|
+
* @param probe - issues a request that succeeds iff the token is good
|
|
314
|
+
* @param describeError - turns a failed probe into a message
|
|
315
|
+
*/
|
|
316
|
+
validateTokenWithProbe(token: string, probe: (token: string) => Promise<Response>, describeError: (response: Response, reason?: string) => Promise<string>): Promise<string>;
|
|
317
|
+
/**
|
|
318
|
+
* #action
|
|
319
|
+
* Opens the provider's auth page and returns a promise for the resulting
|
|
320
|
+
* token. For Electron, drives the flow directly via IPC; for web, opens a
|
|
321
|
+
* popup and waits for the redirect message.
|
|
322
|
+
*/
|
|
323
|
+
getTokenViaAuthFlow(): Promise<string>;
|
|
324
|
+
} & {
|
|
325
|
+
/**
|
|
326
|
+
* #action
|
|
327
|
+
*/
|
|
175
328
|
getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* #action
|
|
331
|
+
*/
|
|
176
332
|
validateToken(token: string, location: UriLocation): Promise<string>;
|
|
177
|
-
} & {
|
|
178
|
-
getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
179
333
|
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
180
334
|
export default stateModelFactory;
|
|
181
335
|
export type OAuthStateModel = ReturnType<typeof stateModelFactory>;
|