@openneuro/server 4.44.0 → 4.44.2
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 +3 -3
- package/src/libs/authentication/jwt.ts +13 -1
- package/src/sentry.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.2",
|
|
4
4
|
"description": "Core service for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@elastic/elasticsearch": "8.13.1",
|
|
22
22
|
"@graphql-tools/schema": "^10.0.0",
|
|
23
23
|
"@keyv/redis": "^4.5.0",
|
|
24
|
-
"@openneuro/search": "^4.44.
|
|
24
|
+
"@openneuro/search": "^4.44.2",
|
|
25
25
|
"@sentry/node": "^8.25.0",
|
|
26
26
|
"@sentry/profiling-node": "^8.25.0",
|
|
27
27
|
"base64url": "^3.0.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "2df85aec35b3122c2be65627745569b914c56380"
|
|
93
93
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import passport from "passport"
|
|
2
2
|
import refresh from "passport-oauth2-refresh"
|
|
3
3
|
import jwt from "jsonwebtoken"
|
|
4
|
+
import * as Sentry from "@sentry/node"
|
|
4
5
|
import { decrypt } from "./crypto"
|
|
5
6
|
import User from "../../models/user"
|
|
6
7
|
import config from "../../config"
|
|
@@ -187,7 +188,18 @@ export const authenticate = (req, res, next) => {
|
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
passport.authenticate("jwt", { session: false }, (err, user) => {
|
|
190
|
-
req.login(user, { session: false }, () =>
|
|
191
|
+
req.login(user, { session: false }, () => {
|
|
192
|
+
if (user) {
|
|
193
|
+
Sentry.setUser({
|
|
194
|
+
id: user.id,
|
|
195
|
+
ip_address: req.headers["x-forwarded-for"] as string,
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
Sentry.setContext("request_headers", {
|
|
199
|
+
"x-forwarded-for": req.headers["x-forwarded-for"],
|
|
200
|
+
})
|
|
201
|
+
next()
|
|
202
|
+
})
|
|
191
203
|
})(req, res, next)
|
|
192
204
|
}
|
|
193
205
|
authenticateAsync()
|