@jbrowse/plugin-authentication 2.2.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 (130) hide show
  1. package/LICENSE +201 -0
  2. package/dist/DropboxOAuthModel/configSchema.d.ts +5 -0
  3. package/dist/DropboxOAuthModel/configSchema.js +69 -0
  4. package/dist/DropboxOAuthModel/configSchema.js.map +1 -0
  5. package/dist/DropboxOAuthModel/index.d.ts +2 -0
  6. package/dist/DropboxOAuthModel/index.js +11 -0
  7. package/dist/DropboxOAuthModel/index.js.map +1 -0
  8. package/dist/DropboxOAuthModel/model.d.ts +98 -0
  9. package/dist/DropboxOAuthModel/model.js +103 -0
  10. package/dist/DropboxOAuthModel/model.js.map +1 -0
  11. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +5 -0
  12. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +59 -0
  13. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js.map +1 -0
  14. package/dist/ExternalTokenModel/configSchema.d.ts +5 -0
  15. package/dist/ExternalTokenModel/configSchema.js +26 -0
  16. package/dist/ExternalTokenModel/configSchema.js.map +1 -0
  17. package/dist/ExternalTokenModel/index.d.ts +2 -0
  18. package/dist/ExternalTokenModel/index.js +11 -0
  19. package/dist/ExternalTokenModel/index.js.map +1 -0
  20. package/dist/ExternalTokenModel/model.d.ts +67 -0
  21. package/dist/ExternalTokenModel/model.js +59 -0
  22. package/dist/ExternalTokenModel/model.js.map +1 -0
  23. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +5 -0
  24. package/dist/GoogleDriveOAuthModel/configSchema.js +53 -0
  25. package/dist/GoogleDriveOAuthModel/configSchema.js.map +1 -0
  26. package/dist/GoogleDriveOAuthModel/index.d.ts +2 -0
  27. package/dist/GoogleDriveOAuthModel/index.js +11 -0
  28. package/dist/GoogleDriveOAuthModel/index.js.map +1 -0
  29. package/dist/GoogleDriveOAuthModel/model.d.ts +111 -0
  30. package/dist/GoogleDriveOAuthModel/model.js +115 -0
  31. package/dist/GoogleDriveOAuthModel/model.js.map +1 -0
  32. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +5 -0
  33. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +55 -0
  34. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js.map +1 -0
  35. package/dist/HTTPBasicModel/configSchema.d.ts +5 -0
  36. package/dist/HTTPBasicModel/configSchema.js +34 -0
  37. package/dist/HTTPBasicModel/configSchema.js.map +1 -0
  38. package/dist/HTTPBasicModel/index.d.ts +2 -0
  39. package/dist/HTTPBasicModel/index.js +11 -0
  40. package/dist/HTTPBasicModel/index.js.map +1 -0
  41. package/dist/HTTPBasicModel/model.d.ts +67 -0
  42. package/dist/HTTPBasicModel/model.js +59 -0
  43. package/dist/HTTPBasicModel/model.js.map +1 -0
  44. package/dist/OAuthModel/configSchema.d.ts +5 -0
  45. package/dist/OAuthModel/configSchema.js +90 -0
  46. package/dist/OAuthModel/configSchema.js.map +1 -0
  47. package/dist/OAuthModel/index.d.ts +2 -0
  48. package/dist/OAuthModel/index.js +11 -0
  49. package/dist/OAuthModel/index.js.map +1 -0
  50. package/dist/OAuthModel/model.d.ts +91 -0
  51. package/dist/OAuthModel/model.js +317 -0
  52. package/dist/OAuthModel/model.js.map +1 -0
  53. package/dist/index.d.ts +399 -0
  54. package/dist/index.js +80 -0
  55. package/dist/index.js.map +1 -0
  56. package/esm/DropboxOAuthModel/configSchema.d.ts +5 -0
  57. package/esm/DropboxOAuthModel/configSchema.js +64 -0
  58. package/esm/DropboxOAuthModel/configSchema.js.map +1 -0
  59. package/esm/DropboxOAuthModel/index.d.ts +2 -0
  60. package/esm/DropboxOAuthModel/index.js +3 -0
  61. package/esm/DropboxOAuthModel/index.js.map +1 -0
  62. package/esm/DropboxOAuthModel/model.d.ts +98 -0
  63. package/esm/DropboxOAuthModel/model.js +96 -0
  64. package/esm/DropboxOAuthModel/model.js.map +1 -0
  65. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +5 -0
  66. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +29 -0
  67. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js.map +1 -0
  68. package/esm/ExternalTokenModel/configSchema.d.ts +5 -0
  69. package/esm/ExternalTokenModel/configSchema.js +24 -0
  70. package/esm/ExternalTokenModel/configSchema.js.map +1 -0
  71. package/esm/ExternalTokenModel/index.d.ts +2 -0
  72. package/esm/ExternalTokenModel/index.js +3 -0
  73. package/esm/ExternalTokenModel/index.js.map +1 -0
  74. package/esm/ExternalTokenModel/model.d.ts +67 -0
  75. package/esm/ExternalTokenModel/model.js +57 -0
  76. package/esm/ExternalTokenModel/model.js.map +1 -0
  77. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +5 -0
  78. package/esm/GoogleDriveOAuthModel/configSchema.js +48 -0
  79. package/esm/GoogleDriveOAuthModel/configSchema.js.map +1 -0
  80. package/esm/GoogleDriveOAuthModel/index.d.ts +2 -0
  81. package/esm/GoogleDriveOAuthModel/index.js +3 -0
  82. package/esm/GoogleDriveOAuthModel/index.js.map +1 -0
  83. package/esm/GoogleDriveOAuthModel/model.d.ts +111 -0
  84. package/esm/GoogleDriveOAuthModel/model.js +108 -0
  85. package/esm/GoogleDriveOAuthModel/model.js.map +1 -0
  86. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +5 -0
  87. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +28 -0
  88. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js.map +1 -0
  89. package/esm/HTTPBasicModel/configSchema.d.ts +5 -0
  90. package/esm/HTTPBasicModel/configSchema.js +32 -0
  91. package/esm/HTTPBasicModel/configSchema.js.map +1 -0
  92. package/esm/HTTPBasicModel/index.d.ts +2 -0
  93. package/esm/HTTPBasicModel/index.js +3 -0
  94. package/esm/HTTPBasicModel/index.js.map +1 -0
  95. package/esm/HTTPBasicModel/model.d.ts +67 -0
  96. package/esm/HTTPBasicModel/model.js +57 -0
  97. package/esm/HTTPBasicModel/model.js.map +1 -0
  98. package/esm/OAuthModel/configSchema.d.ts +5 -0
  99. package/esm/OAuthModel/configSchema.js +88 -0
  100. package/esm/OAuthModel/configSchema.js.map +1 -0
  101. package/esm/OAuthModel/index.d.ts +2 -0
  102. package/esm/OAuthModel/index.js +3 -0
  103. package/esm/OAuthModel/index.js.map +1 -0
  104. package/esm/OAuthModel/model.d.ts +91 -0
  105. package/esm/OAuthModel/model.js +289 -0
  106. package/esm/OAuthModel/model.js.map +1 -0
  107. package/esm/index.d.ts +399 -0
  108. package/esm/index.js +64 -0
  109. package/esm/index.js.map +1 -0
  110. package/package.json +63 -0
  111. package/src/DropboxOAuthModel/configSchema.ts +77 -0
  112. package/src/DropboxOAuthModel/index.ts +2 -0
  113. package/src/DropboxOAuthModel/model.tsx +141 -0
  114. package/src/ExternalTokenModel/ExternalTokenEntryForm.tsx +61 -0
  115. package/src/ExternalTokenModel/configSchema.ts +36 -0
  116. package/src/ExternalTokenModel/index.ts +2 -0
  117. package/src/ExternalTokenModel/model.tsx +70 -0
  118. package/src/GoogleDriveOAuthModel/configSchema.ts +61 -0
  119. package/src/GoogleDriveOAuthModel/index.ts +2 -0
  120. package/src/GoogleDriveOAuthModel/model.tsx +174 -0
  121. package/src/HTTPBasicModel/HTTPBasicLoginForm.tsx +71 -0
  122. package/src/HTTPBasicModel/configSchema.ts +43 -0
  123. package/src/HTTPBasicModel/index.ts +2 -0
  124. package/src/HTTPBasicModel/model.tsx +70 -0
  125. package/src/OAuthModel/configSchema.ts +98 -0
  126. package/src/OAuthModel/index.ts +2 -0
  127. package/src/OAuthModel/model.tsx +357 -0
  128. package/src/__snapshots__/index.test.js.snap +8 -0
  129. package/src/index.test.js +96 -0
  130. package/src/index.ts +97 -0
package/esm/index.d.ts ADDED
@@ -0,0 +1,399 @@
1
+ /// <reference types="react" />
2
+ import Plugin from '@jbrowse/core/Plugin';
3
+ import PluginManager from '@jbrowse/core/PluginManager';
4
+ import { configSchema as OAuthConfigSchema, modelFactory as OAuthInternetAccountModelFactory } from './OAuthModel';
5
+ import { configSchema as ExternalTokenConfigSchema, modelFactory as ExternalTokenInternetAccountModelFactory } from './ExternalTokenModel';
6
+ import { configSchema as HTTPBasicConfigSchema, modelFactory as HTTPBasicInternetAccountModelFactory } from './HTTPBasicModel';
7
+ import { configSchema as DropboxOAuthConfigSchema, modelFactory as DropboxOAuthInternetAccountModelFactory } from './DropboxOAuthModel';
8
+ import { configSchema as GoogleDriveOAuthConfigSchema, modelFactory as GoogleDriveOAuthInternetAccountModelFactory } from './GoogleDriveOAuthModel';
9
+ export default class AuthenticationPlugin extends Plugin {
10
+ name: string;
11
+ exports: {
12
+ OAuthConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
13
+ OAuthInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType) => import("mobx-state-tree").IModelType<{
14
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
15
+ type: import("mobx-state-tree").ISimpleType<string>;
16
+ } & {
17
+ type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">;
18
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
19
+ }, {
20
+ readonly name: string;
21
+ readonly description: string;
22
+ readonly internetAccountId: string;
23
+ readonly authHeader: string;
24
+ readonly tokenType: string;
25
+ readonly domains: string[];
26
+ readonly toggleContents: import("react").ReactNode;
27
+ readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
28
+ readonly selectorLabel: string | undefined;
29
+ } & {
30
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
31
+ readonly tokenKey: string;
32
+ } & {
33
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
34
+ storeToken(token: string): void;
35
+ removeToken(): void;
36
+ retrieveToken(): string | null;
37
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
38
+ } & {
39
+ getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
40
+ } & {
41
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
42
+ headers: Headers;
43
+ body?: BodyInit | null | undefined;
44
+ cache?: RequestCache | undefined;
45
+ credentials?: RequestCredentials | undefined;
46
+ integrity?: string | undefined;
47
+ keepalive?: boolean | undefined;
48
+ method?: string | undefined;
49
+ mode?: RequestMode | undefined;
50
+ redirect?: RequestRedirect | undefined;
51
+ referrer?: string | undefined;
52
+ referrerPolicy?: ReferrerPolicy | undefined;
53
+ signal?: AbortSignal | null | undefined;
54
+ window?: null | undefined;
55
+ };
56
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
57
+ internetAccountType: string;
58
+ authInfo: {
59
+ token: string;
60
+ configuration: any;
61
+ };
62
+ }>;
63
+ } & {
64
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
65
+ } & {
66
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
67
+ } & {
68
+ readonly codeVerifierPKCE: string;
69
+ } & {
70
+ readonly authEndpoint: string;
71
+ readonly tokenEndpoint: string;
72
+ readonly needsPKCE: boolean;
73
+ readonly clientId: string;
74
+ readonly scopes: string;
75
+ state(): string | undefined;
76
+ readonly responseType: "code" | "token";
77
+ readonly hasRefreshToken: boolean;
78
+ readonly refreshTokenKey: string;
79
+ } & {
80
+ storeRefreshToken(refreshToken: string): void;
81
+ removeRefreshToken(): void;
82
+ retrieveRefreshToken(): string | null;
83
+ exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>;
84
+ exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
85
+ } & {
86
+ addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void;
87
+ deleteMessageChannel(): void;
88
+ finishOAuthWindow(event: MessageEvent<any>, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
89
+ useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
90
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
91
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
92
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
93
+ ExternalTokenConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
94
+ ExternalTokenInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType) => import("mobx-state-tree").IModelType<{
95
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
96
+ type: import("mobx-state-tree").ISimpleType<string>;
97
+ } & {
98
+ type: import("mobx-state-tree").ISimpleType<"ExternalTokenInternetAccount">;
99
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
100
+ }, {
101
+ readonly name: string;
102
+ readonly description: string;
103
+ readonly internetAccountId: string;
104
+ readonly authHeader: string;
105
+ readonly tokenType: string;
106
+ readonly domains: string[];
107
+ readonly toggleContents: import("react").ReactNode;
108
+ readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
109
+ readonly selectorLabel: string | undefined;
110
+ } & {
111
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
112
+ readonly tokenKey: string;
113
+ } & {
114
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
115
+ storeToken(token: string): void;
116
+ removeToken(): void;
117
+ retrieveToken(): string | null;
118
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
119
+ } & {
120
+ getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
121
+ } & {
122
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
123
+ headers: Headers;
124
+ body?: BodyInit | null | undefined;
125
+ cache?: RequestCache | undefined;
126
+ credentials?: RequestCredentials | undefined;
127
+ integrity?: string | undefined;
128
+ keepalive?: boolean | undefined;
129
+ method?: string | undefined;
130
+ mode?: RequestMode | undefined;
131
+ redirect?: RequestRedirect | undefined;
132
+ referrer?: string | undefined;
133
+ referrerPolicy?: ReferrerPolicy | undefined;
134
+ signal?: AbortSignal | null | undefined;
135
+ window?: null | undefined;
136
+ };
137
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
138
+ internetAccountType: string;
139
+ authInfo: {
140
+ token: string;
141
+ configuration: any;
142
+ };
143
+ }>;
144
+ } & {
145
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
146
+ } & {
147
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
148
+ } & {
149
+ readonly validateWithHEAD: boolean;
150
+ } & {
151
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
152
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
153
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
154
+ HTTPBasicConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
155
+ HTTPBasicInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType) => import("mobx-state-tree").IModelType<{
156
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
157
+ type: import("mobx-state-tree").ISimpleType<string>;
158
+ } & {
159
+ type: import("mobx-state-tree").ISimpleType<"HTTPBasicInternetAccount">;
160
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
161
+ }, {
162
+ readonly name: string;
163
+ readonly description: string;
164
+ readonly internetAccountId: string;
165
+ readonly authHeader: string;
166
+ readonly tokenType: string;
167
+ readonly domains: string[];
168
+ readonly toggleContents: import("react").ReactNode;
169
+ readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
170
+ readonly selectorLabel: string | undefined;
171
+ } & {
172
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
173
+ readonly tokenKey: string;
174
+ } & {
175
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
176
+ storeToken(token: string): void;
177
+ removeToken(): void;
178
+ retrieveToken(): string | null;
179
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
180
+ } & {
181
+ getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
182
+ } & {
183
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
184
+ headers: Headers;
185
+ body?: BodyInit | null | undefined;
186
+ cache?: RequestCache | undefined;
187
+ credentials?: RequestCredentials | undefined;
188
+ integrity?: string | undefined;
189
+ keepalive?: boolean | undefined;
190
+ method?: string | undefined;
191
+ mode?: RequestMode | undefined;
192
+ redirect?: RequestRedirect | undefined;
193
+ referrer?: string | undefined;
194
+ referrerPolicy?: ReferrerPolicy | undefined;
195
+ signal?: AbortSignal | null | undefined;
196
+ window?: null | undefined;
197
+ };
198
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
199
+ internetAccountType: string;
200
+ authInfo: {
201
+ token: string;
202
+ configuration: any;
203
+ };
204
+ }>;
205
+ } & {
206
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
207
+ } & {
208
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
209
+ } & {
210
+ readonly validateWithHEAD: boolean;
211
+ } & {
212
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
213
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
214
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
215
+ DropboxOAuthConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
216
+ DropboxOAuthInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType) => import("mobx-state-tree").IModelType<{
217
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
218
+ type: import("mobx-state-tree").ISimpleType<string>;
219
+ } & {
220
+ type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">;
221
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
222
+ } & {
223
+ type: import("mobx-state-tree").ISimpleType<"DropboxOAuthInternetAccount">;
224
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
225
+ }, {
226
+ readonly name: string;
227
+ readonly description: string;
228
+ readonly internetAccountId: string;
229
+ readonly authHeader: string;
230
+ readonly tokenType: string;
231
+ readonly domains: string[];
232
+ readonly toggleContents: import("react").ReactNode;
233
+ readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
234
+ readonly selectorLabel: string | undefined;
235
+ } & {
236
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
237
+ readonly tokenKey: string;
238
+ } & {
239
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
240
+ storeToken(token: string): void;
241
+ removeToken(): void;
242
+ retrieveToken(): string | null;
243
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
244
+ } & {
245
+ getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
246
+ } & {
247
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
248
+ headers: Headers;
249
+ body?: BodyInit | null | undefined;
250
+ cache?: RequestCache | undefined;
251
+ credentials?: RequestCredentials | undefined;
252
+ integrity?: string | undefined;
253
+ keepalive?: boolean | undefined;
254
+ method?: string | undefined;
255
+ mode?: RequestMode | undefined;
256
+ redirect?: RequestRedirect | undefined;
257
+ referrer?: string | undefined;
258
+ referrerPolicy?: ReferrerPolicy | undefined;
259
+ signal?: AbortSignal | null | undefined;
260
+ window?: null | undefined;
261
+ };
262
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
263
+ internetAccountType: string;
264
+ authInfo: {
265
+ token: string;
266
+ configuration: any;
267
+ };
268
+ }>;
269
+ } & {
270
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
271
+ } & {
272
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
273
+ } & {
274
+ readonly codeVerifierPKCE: string;
275
+ } & {
276
+ readonly authEndpoint: string;
277
+ readonly tokenEndpoint: string;
278
+ readonly needsPKCE: boolean;
279
+ readonly clientId: string;
280
+ readonly scopes: string;
281
+ state(): string | undefined;
282
+ readonly responseType: "code" | "token";
283
+ readonly hasRefreshToken: boolean;
284
+ readonly refreshTokenKey: string;
285
+ } & {
286
+ storeRefreshToken(refreshToken: string): void;
287
+ removeRefreshToken(): void;
288
+ retrieveRefreshToken(): string | null;
289
+ exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>;
290
+ exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
291
+ } & {
292
+ addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void;
293
+ deleteMessageChannel(): void;
294
+ finishOAuthWindow(event: MessageEvent<any>, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
295
+ useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
296
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
297
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
298
+ } & {
299
+ readonly toggleContents: JSX.Element;
300
+ readonly selectorLabel: string;
301
+ } & {
302
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
303
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
304
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
305
+ GoogleDriveOAuthConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
306
+ GoogleDriveOAuthInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType) => import("mobx-state-tree").IModelType<{
307
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
308
+ type: import("mobx-state-tree").ISimpleType<string>;
309
+ } & {
310
+ type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">;
311
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
312
+ } & {
313
+ type: import("mobx-state-tree").ISimpleType<"GoogleDriveOAuthInternetAccount">;
314
+ configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
315
+ }, {
316
+ readonly name: string;
317
+ readonly description: string;
318
+ readonly internetAccountId: string;
319
+ readonly authHeader: string;
320
+ readonly tokenType: string;
321
+ readonly domains: string[];
322
+ readonly toggleContents: import("react").ReactNode;
323
+ readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
324
+ readonly selectorLabel: string | undefined;
325
+ } & {
326
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
327
+ readonly tokenKey: string;
328
+ } & {
329
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
330
+ storeToken(token: string): void;
331
+ removeToken(): void;
332
+ retrieveToken(): string | null;
333
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
334
+ } & {
335
+ getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
336
+ } & {
337
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
338
+ headers: Headers;
339
+ body?: BodyInit | null | undefined;
340
+ cache?: RequestCache | undefined;
341
+ credentials?: RequestCredentials | undefined;
342
+ integrity?: string | undefined;
343
+ keepalive?: boolean | undefined;
344
+ method?: string | undefined;
345
+ mode?: RequestMode | undefined;
346
+ redirect?: RequestRedirect | undefined;
347
+ referrer?: string | undefined;
348
+ referrerPolicy?: ReferrerPolicy | undefined;
349
+ signal?: AbortSignal | null | undefined;
350
+ window?: null | undefined;
351
+ };
352
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
353
+ internetAccountType: string;
354
+ authInfo: {
355
+ token: string;
356
+ configuration: any;
357
+ };
358
+ }>;
359
+ } & {
360
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
361
+ } & {
362
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
363
+ } & {
364
+ readonly codeVerifierPKCE: string;
365
+ } & {
366
+ readonly authEndpoint: string;
367
+ readonly tokenEndpoint: string;
368
+ readonly needsPKCE: boolean;
369
+ readonly clientId: string;
370
+ readonly scopes: string;
371
+ state(): string | undefined;
372
+ readonly responseType: "code" | "token";
373
+ readonly hasRefreshToken: boolean;
374
+ readonly refreshTokenKey: string;
375
+ } & {
376
+ storeRefreshToken(refreshToken: string): void;
377
+ removeRefreshToken(): void;
378
+ retrieveRefreshToken(): string | null;
379
+ exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>;
380
+ exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
381
+ } & {
382
+ addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void;
383
+ deleteMessageChannel(): void;
384
+ finishOAuthWindow(event: MessageEvent<any>, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
385
+ useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
386
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
387
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
388
+ } & {
389
+ readonly toggleContents: JSX.Element;
390
+ readonly selectorLabel: string;
391
+ } & {
392
+ getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
393
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("./GoogleDriveOAuthModel/model").GoogleDriveFile;
394
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
395
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
396
+ };
397
+ install(pluginManager: PluginManager): void;
398
+ }
399
+ export { OAuthConfigSchema, OAuthInternetAccountModelFactory, ExternalTokenConfigSchema, ExternalTokenInternetAccountModelFactory, HTTPBasicConfigSchema, HTTPBasicInternetAccountModelFactory, DropboxOAuthConfigSchema, DropboxOAuthInternetAccountModelFactory, GoogleDriveOAuthConfigSchema, GoogleDriveOAuthInternetAccountModelFactory, };
package/esm/index.js ADDED
@@ -0,0 +1,64 @@
1
+ import Plugin from '@jbrowse/core/Plugin';
2
+ import InternetAccountType from '@jbrowse/core/pluggableElementTypes/InternetAccountType';
3
+ import { configSchema as OAuthConfigSchema, modelFactory as OAuthInternetAccountModelFactory, } from './OAuthModel';
4
+ import { configSchema as ExternalTokenConfigSchema, modelFactory as ExternalTokenInternetAccountModelFactory, } from './ExternalTokenModel';
5
+ import { configSchema as HTTPBasicConfigSchema, modelFactory as HTTPBasicInternetAccountModelFactory, } from './HTTPBasicModel';
6
+ import { configSchema as DropboxOAuthConfigSchema, modelFactory as DropboxOAuthInternetAccountModelFactory, } from './DropboxOAuthModel';
7
+ import { configSchema as GoogleDriveOAuthConfigSchema, modelFactory as GoogleDriveOAuthInternetAccountModelFactory, } from './GoogleDriveOAuthModel';
8
+ export default class AuthenticationPlugin extends Plugin {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.name = 'AuthenticationPlugin';
12
+ this.exports = {
13
+ OAuthConfigSchema,
14
+ OAuthInternetAccountModelFactory,
15
+ ExternalTokenConfigSchema,
16
+ ExternalTokenInternetAccountModelFactory,
17
+ HTTPBasicConfigSchema,
18
+ HTTPBasicInternetAccountModelFactory,
19
+ DropboxOAuthConfigSchema,
20
+ DropboxOAuthInternetAccountModelFactory,
21
+ GoogleDriveOAuthConfigSchema,
22
+ GoogleDriveOAuthInternetAccountModelFactory,
23
+ };
24
+ }
25
+ install(pluginManager) {
26
+ pluginManager.addInternetAccountType(() => {
27
+ return new InternetAccountType({
28
+ name: 'OAuthInternetAccount',
29
+ configSchema: OAuthConfigSchema,
30
+ stateModel: OAuthInternetAccountModelFactory(OAuthConfigSchema),
31
+ });
32
+ });
33
+ pluginManager.addInternetAccountType(() => {
34
+ return new InternetAccountType({
35
+ name: 'ExternalTokenInternetAccount',
36
+ configSchema: ExternalTokenConfigSchema,
37
+ stateModel: ExternalTokenInternetAccountModelFactory(ExternalTokenConfigSchema),
38
+ });
39
+ });
40
+ pluginManager.addInternetAccountType(() => {
41
+ return new InternetAccountType({
42
+ name: 'HTTPBasicInternetAccount',
43
+ configSchema: HTTPBasicConfigSchema,
44
+ stateModel: HTTPBasicInternetAccountModelFactory(HTTPBasicConfigSchema),
45
+ });
46
+ });
47
+ pluginManager.addInternetAccountType(() => {
48
+ return new InternetAccountType({
49
+ name: 'DropboxOAuthInternetAccount',
50
+ configSchema: DropboxOAuthConfigSchema,
51
+ stateModel: DropboxOAuthInternetAccountModelFactory(DropboxOAuthConfigSchema),
52
+ });
53
+ });
54
+ pluginManager.addInternetAccountType(() => {
55
+ return new InternetAccountType({
56
+ name: 'GoogleDriveOAuthInternetAccount',
57
+ configSchema: GoogleDriveOAuthConfigSchema,
58
+ stateModel: GoogleDriveOAuthInternetAccountModelFactory(GoogleDriveOAuthConfigSchema),
59
+ });
60
+ });
61
+ }
62
+ }
63
+ export { OAuthConfigSchema, OAuthInternetAccountModelFactory, ExternalTokenConfigSchema, ExternalTokenInternetAccountModelFactory, HTTPBasicConfigSchema, HTTPBasicInternetAccountModelFactory, DropboxOAuthConfigSchema, DropboxOAuthInternetAccountModelFactory, GoogleDriveOAuthConfigSchema, GoogleDriveOAuthInternetAccountModelFactory, };
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAEzC,OAAO,mBAAmB,MAAM,yDAAyD,CAAA;AACzF,OAAO,EACL,YAAY,IAAI,iBAAiB,EACjC,YAAY,IAAI,gCAAgC,GACjD,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,YAAY,IAAI,yBAAyB,EACzC,YAAY,IAAI,wCAAwC,GACzD,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,YAAY,IAAI,qBAAqB,EACrC,YAAY,IAAI,oCAAoC,GACrD,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,YAAY,IAAI,wBAAwB,EACxC,YAAY,IAAI,uCAAuC,GACxD,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,YAAY,IAAI,4BAA4B,EAC5C,YAAY,IAAI,2CAA2C,GAC5D,MAAM,yBAAyB,CAAA;AAEhC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,MAAM;IAAxD;;QACE,SAAI,GAAG,sBAAsB,CAAA;QAE7B,YAAO,GAAG;YACR,iBAAiB;YACjB,gCAAgC;YAChC,yBAAyB;YACzB,wCAAwC;YACxC,qBAAqB;YACrB,oCAAoC;YACpC,wBAAwB;YACxB,uCAAuC;YACvC,4BAA4B;YAC5B,2CAA2C;SAC5C,CAAA;IA6CH,CAAC;IA3CC,OAAO,CAAC,aAA4B;QAClC,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE;YACxC,OAAO,IAAI,mBAAmB,CAAC;gBAC7B,IAAI,EAAE,sBAAsB;gBAC5B,YAAY,EAAE,iBAAiB;gBAC/B,UAAU,EAAE,gCAAgC,CAAC,iBAAiB,CAAC;aAChE,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE;YACxC,OAAO,IAAI,mBAAmB,CAAC;gBAC7B,IAAI,EAAE,8BAA8B;gBACpC,YAAY,EAAE,yBAAyB;gBACvC,UAAU,EAAE,wCAAwC,CAClD,yBAAyB,CAC1B;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE;YACxC,OAAO,IAAI,mBAAmB,CAAC;gBAC7B,IAAI,EAAE,0BAA0B;gBAChC,YAAY,EAAE,qBAAqB;gBACnC,UAAU,EAAE,oCAAoC,CAAC,qBAAqB,CAAC;aACxE,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE;YACxC,OAAO,IAAI,mBAAmB,CAAC;gBAC7B,IAAI,EAAE,6BAA6B;gBACnC,YAAY,EAAE,wBAAwB;gBACtC,UAAU,EAAE,uCAAuC,CACjD,wBAAwB,CACzB;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE;YACxC,OAAO,IAAI,mBAAmB,CAAC;gBAC7B,IAAI,EAAE,iCAAiC;gBACvC,YAAY,EAAE,4BAA4B;gBAC1C,UAAU,EAAE,2CAA2C,CACrD,4BAA4B,CAC7B;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,OAAO,EACL,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,wCAAwC,EACxC,qBAAqB,EACrB,oCAAoC,EACpC,wBAAwB,EACxB,uCAAuC,EACvC,4BAA4B,EAC5B,2CAA2C,GAC5C,CAAA"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@jbrowse/plugin-authentication",
3
+ "version": "2.2.0",
4
+ "description": "JBrowse 2 Authentication",
5
+ "keywords": [
6
+ "jbrowse",
7
+ "jbrowse2"
8
+ ],
9
+ "license": "Apache-2.0",
10
+ "homepage": "https://jbrowse.org",
11
+ "bugs": "https://github.com/GMOD/jbrowse-components/issues",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/GMOD/jbrowse-components.git",
15
+ "directory": "plugins/authentication"
16
+ },
17
+ "author": "JBrowse Team",
18
+ "distMain": "dist/index.js",
19
+ "srcMain": "src/index.ts",
20
+ "main": "dist/index.js",
21
+ "files": [
22
+ "dist",
23
+ "src",
24
+ "esm"
25
+ ],
26
+ "scripts": {
27
+ "build": "npm-run-all build:*",
28
+ "test": "cd ../..; jest plugins/authentication",
29
+ "prepublishOnly": "yarn test",
30
+ "prepack": "yarn build; yarn useDist",
31
+ "postpack": "yarn useSrc",
32
+ "useDist": "node ../../scripts/useDist.js",
33
+ "useSrc": "node ../../scripts/useSrc.js",
34
+ "prebuild": "npm run clean",
35
+ "build:esm": "tsc --build tsconfig.build.esm.json",
36
+ "build:es5": "tsc --build tsconfig.build.es5.json",
37
+ "clean": "rimraf dist esm *.tsbuildinfo"
38
+ },
39
+ "dependencies": {
40
+ "jwt-decode": "^3.1.2"
41
+ },
42
+ "peerDependencies": {
43
+ "@jbrowse/core": "^2.0.0",
44
+ "@mui/material": "^5.0.0",
45
+ "crypto-js": "^3.0.0",
46
+ "electron": "^15.0.0",
47
+ "generic-filehandle": "^3.0.0",
48
+ "mobx": "^6.0.0",
49
+ "mobx-react": "^7.0.0",
50
+ "mobx-state-tree": "^5.0.0",
51
+ "prop-types": "^15.0.0",
52
+ "react": ">=16.8.0",
53
+ "react-dom": ">=16.8.0",
54
+ "rxjs": "^6.0.0"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "distModule": "esm/index.js",
60
+ "srcModule": "src/index.ts",
61
+ "module": "esm/index.js",
62
+ "gitHead": "cf31db8d833117f8822510340664fb3f045975cb"
63
+ }
@@ -0,0 +1,77 @@
1
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { Instance } from 'mobx-state-tree'
3
+ import OAuthConfigSchema from '../OAuthModel/configSchema'
4
+
5
+ /**
6
+ * #config DropboxOAuthInternetAccount
7
+ */
8
+ function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
9
+
10
+ const DropboxOAuthConfigSchema = ConfigurationSchema(
11
+ 'DropboxOAuthInternetAccount',
12
+ {
13
+ /**
14
+ * #slot
15
+ */
16
+ authEndpoint: {
17
+ description: 'the authorization code endpoint of the internet account',
18
+ type: 'string',
19
+ defaultValue: 'https://www.dropbox.com/oauth2/authorize',
20
+ },
21
+ /**
22
+ * #slot
23
+ */
24
+ tokenEndpoint: {
25
+ description: 'the token endpoint of the internet account',
26
+ type: 'string',
27
+ defaultValue: 'https://api.dropbox.com/oauth2/token',
28
+ },
29
+ /**
30
+ * #slot
31
+ */
32
+ needsPKCE: {
33
+ description: 'boolean to indicate if the endpoint needs a PKCE code',
34
+ type: 'boolean',
35
+ defaultValue: true,
36
+ },
37
+ /**
38
+ * #slot
39
+ */
40
+ domains: {
41
+ description:
42
+ 'array of valid domains the url can contain to use this account',
43
+ type: 'stringArray',
44
+ defaultValue: [
45
+ 'addtodropbox.com',
46
+ 'db.tt',
47
+ 'dropbox.com',
48
+ 'dropboxapi.com',
49
+ 'dropboxbusiness.com',
50
+ 'dropbox.tech',
51
+ 'getdropbox.com',
52
+ ],
53
+ },
54
+ /**
55
+ * #slot
56
+ */
57
+ hasRefreshToken: {
58
+ description: 'true if the endpoint can supply a refresh token',
59
+ type: 'boolean',
60
+ defaultValue: true,
61
+ },
62
+ },
63
+ {
64
+ /**
65
+ * #baseConfiguration
66
+ */
67
+ baseConfiguration: OAuthConfigSchema,
68
+ explicitlyTyped: true,
69
+ },
70
+ )
71
+
72
+ export type DropboxOAuthInternetAccountConfigModel =
73
+ typeof DropboxOAuthConfigSchema
74
+
75
+ export type DropboxOAuthInternetAccountConfig =
76
+ Instance<DropboxOAuthInternetAccountConfigModel>
77
+ export default DropboxOAuthConfigSchema
@@ -0,0 +1,2 @@
1
+ export { default as configSchema } from './configSchema'
2
+ export { default as modelFactory } from './model'