@openneuro/server 4.13.1-alpha.3 → 4.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/server",
3
- "version": "4.13.1-alpha.3",
3
+ "version": "4.14.0",
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.4.17",
18
+ "@apollo/client": "3.7.2",
19
19
  "@elastic/elasticsearch": "7.15.0",
20
- "@openneuro/search": "^4.13.1-alpha.3",
20
+ "@openneuro/search": "^4.14.0",
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.4",
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": "51c893f25621433410459da03744439de518faa0"
95
+ "gitHead": "eb5ed9e8c09cd0c87a44b2cbdc95cd1e92282e10"
99
96
  }
@@ -304,6 +304,7 @@ export const typeDefs = `
304
304
  id: ID!
305
305
  provider: UserProvider
306
306
  avatar: String
307
+ orcid: String
307
308
  created: DateTime!
308
309
  modified: DateTime
309
310
  lastSeen: DateTime
@@ -317,7 +318,6 @@ export const typeDefs = `
317
318
  enum UserProvider {
318
319
  google
319
320
  orcid
320
- globus
321
321
  }
322
322
 
323
323
  # Connection for a list of datasets
@@ -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 => {
@@ -34,13 +32,7 @@ const loadProfile = profile => {
34
32
  name: profile.info.name,
35
33
  provider: profile.provider,
36
34
  providerId: profile.orcid,
37
- }
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,
35
+ orcid: profile.orcid,
44
36
  }
45
37
  } else {
46
38
  // Some unknown profile type
@@ -93,25 +85,6 @@ export const verifyORCIDUser = (
93
85
  .catch(err => done(err, null))
94
86
  }
95
87
 
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
88
  export const setupPassportAuth = () => {
116
89
  // Setup all strategies here
117
90
 
@@ -173,24 +146,10 @@ export const setupPassportAuth = () => {
173
146
  config.auth.orcid.apiURI.includes('sandbox'),
174
147
  clientID: config.auth.orcid.clientID,
175
148
  clientSecret: config.auth.orcid.clientSecret,
176
- scope: '/read-limited',
177
149
  callbackURL: `${config.url + config.apiPrefix}auth/orcid/callback`,
178
150
  },
179
151
  verifyORCIDUser,
180
152
  )
181
153
  passport.use(PROVIDERS.ORCID, orcidStrategy)
182
154
  }
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
155
  }
@@ -8,6 +8,7 @@ export interface UserDocument extends Document {
8
8
  name: string
9
9
  provider: StaticRangeInit
10
10
  providerId: string
11
+ orcid: string
11
12
  refresh: string
12
13
  admin: boolean
13
14
  blocked: boolean
@@ -21,6 +22,7 @@ const userSchema = new Schema({
21
22
  name: String,
22
23
  provider: String, // Login provider
23
24
  providerId: String, // Login provider unique id
25
+ orcid: String, // ORCID iD regardless of provider id
24
26
  refresh: String,
25
27
  admin: { type: Boolean, default: false },
26
28
  blocked: { type: Boolean, default: false },