@openneuro/server 4.13.1-alpha.3 → 4.14.0-alpha.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0-alpha.1",
|
|
4
4
|
"description": "Core service for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -15,19 +15,17 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "Squishymedia",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@apollo/client": "3.
|
|
18
|
+
"@apollo/client": "3.7.2",
|
|
19
19
|
"@elastic/elasticsearch": "7.15.0",
|
|
20
|
-
"@openneuro/search": "^4.
|
|
20
|
+
"@openneuro/search": "^4.14.0-alpha.1",
|
|
21
21
|
"@passport-next/passport-google-oauth2": "^1.0.0",
|
|
22
22
|
"@sentry/node": "^4.5.3",
|
|
23
23
|
"apollo-server": "2.25.4",
|
|
24
24
|
"apollo-server-cache-redis": "1.4.0",
|
|
25
25
|
"apollo-server-express": "2.25.3",
|
|
26
|
-
"async": "^2.4.1",
|
|
27
26
|
"base64url": "^3.0.0",
|
|
28
27
|
"body-parser": "^1.18.2",
|
|
29
28
|
"cookie-parser": "^1.4.3",
|
|
30
|
-
"crypto": "^1.0.1",
|
|
31
29
|
"date-fns": "^2.16.1",
|
|
32
30
|
"draft-js": "^0.11.7",
|
|
33
31
|
"draft-js-export-html": "^1.4.1",
|
|
@@ -51,11 +49,10 @@
|
|
|
51
49
|
"node-mailjet": "^3.3.5",
|
|
52
50
|
"object-hash": "2.1.1",
|
|
53
51
|
"passport": "^0.6.0",
|
|
54
|
-
"passport-globus": "^0.0.1",
|
|
55
52
|
"passport-google-oauth20": "^1.0.0",
|
|
56
53
|
"passport-jwt": "^4.0.0",
|
|
57
54
|
"passport-oauth2-refresh": "^2.0.0",
|
|
58
|
-
"passport-orcid": "0.0.
|
|
55
|
+
"passport-orcid": "^0.0.3",
|
|
59
56
|
"react": "^17.0.1",
|
|
60
57
|
"react-dom": "^17.0.1",
|
|
61
58
|
"redlock": "^4.0.0",
|
|
@@ -95,5 +92,5 @@
|
|
|
95
92
|
"publishConfig": {
|
|
96
93
|
"access": "public"
|
|
97
94
|
},
|
|
98
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "e901db29ed49827d7bf5e0cf3138b0b88749d851"
|
|
99
96
|
}
|
|
@@ -3,7 +3,6 @@ import refresh from 'passport-oauth2-refresh'
|
|
|
3
3
|
import { Strategy as JwtStrategy } from 'passport-jwt'
|
|
4
4
|
import { Strategy as GoogleStrategy } from 'passport-google-oauth20'
|
|
5
5
|
import { Strategy as ORCIDStrategy } from 'passport-orcid'
|
|
6
|
-
import { Strategy as GlobusStrategy } from 'passport-globus'
|
|
7
6
|
import config from '../../config.js'
|
|
8
7
|
import User from '../../models/user'
|
|
9
8
|
import { encrypt } from './crypto'
|
|
@@ -13,7 +12,6 @@ import orcid from '../orcid.js'
|
|
|
13
12
|
const PROVIDERS = {
|
|
14
13
|
GOOGLE: 'google',
|
|
15
14
|
ORCID: 'orcid',
|
|
16
|
-
GLOBUS: 'globus',
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
const loadProfile = profile => {
|
|
@@ -35,13 +33,6 @@ const loadProfile = profile => {
|
|
|
35
33
|
provider: profile.provider,
|
|
36
34
|
providerId: profile.orcid,
|
|
37
35
|
}
|
|
38
|
-
} else if (profile.provider === PROVIDERS.GLOBUS) {
|
|
39
|
-
return {
|
|
40
|
-
email: profile.email,
|
|
41
|
-
name: profile.name,
|
|
42
|
-
provider: profile.provider,
|
|
43
|
-
providerId: profile.sub,
|
|
44
|
-
}
|
|
45
36
|
} else {
|
|
46
37
|
// Some unknown profile type
|
|
47
38
|
return new Error('Unhandled profile type.')
|
|
@@ -93,25 +84,6 @@ export const verifyORCIDUser = (
|
|
|
93
84
|
.catch(err => done(err, null))
|
|
94
85
|
}
|
|
95
86
|
|
|
96
|
-
export const verifyGlobusUser = (
|
|
97
|
-
accessToken,
|
|
98
|
-
refreshToken,
|
|
99
|
-
profile,
|
|
100
|
-
params,
|
|
101
|
-
done,
|
|
102
|
-
) => {
|
|
103
|
-
const decodedProfile = decodeJWT(profile.id_token)
|
|
104
|
-
decodedProfile.provider = PROVIDERS.GLOBUS
|
|
105
|
-
const profileUpdate = loadProfile(decodedProfile)
|
|
106
|
-
User.findOneAndUpdate(
|
|
107
|
-
{ providerId: decodedProfile.sub, provider: decodedProfile.provider },
|
|
108
|
-
profileUpdate,
|
|
109
|
-
{ upsert: true, new: true, setDefaultsOnInsert: true },
|
|
110
|
-
)
|
|
111
|
-
.then(user => done(null, addJWT(config)(user)))
|
|
112
|
-
.catch(err => done(err, null))
|
|
113
|
-
}
|
|
114
|
-
|
|
115
87
|
export const setupPassportAuth = () => {
|
|
116
88
|
// Setup all strategies here
|
|
117
89
|
|
|
@@ -173,24 +145,10 @@ export const setupPassportAuth = () => {
|
|
|
173
145
|
config.auth.orcid.apiURI.includes('sandbox'),
|
|
174
146
|
clientID: config.auth.orcid.clientID,
|
|
175
147
|
clientSecret: config.auth.orcid.clientSecret,
|
|
176
|
-
scope: '/read-limited',
|
|
177
148
|
callbackURL: `${config.url + config.apiPrefix}auth/orcid/callback`,
|
|
178
149
|
},
|
|
179
150
|
verifyORCIDUser,
|
|
180
151
|
)
|
|
181
152
|
passport.use(PROVIDERS.ORCID, orcidStrategy)
|
|
182
153
|
}
|
|
183
|
-
|
|
184
|
-
// finally globus
|
|
185
|
-
if (config.auth.globus.clientID && config.auth.globus.clientSecret) {
|
|
186
|
-
const globusStrategy = new GlobusStrategy(
|
|
187
|
-
{
|
|
188
|
-
clientID: config.auth.globus.clientID,
|
|
189
|
-
clientSecret: config.auth.globus.clientSecret,
|
|
190
|
-
callbackURL: `${config.url + config.apiPrefix}auth/globus/callback`,
|
|
191
|
-
},
|
|
192
|
-
verifyGlobusUser,
|
|
193
|
-
)
|
|
194
|
-
passport.use(PROVIDERS.GLOBUS, globusStrategy)
|
|
195
|
-
}
|
|
196
154
|
}
|