@opensaas/keystone-nextjs-auth 22.2.1 → 22.2.2
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -386,13 +386,6 @@ function createAuth({
|
|
386
386
|
}) => {
|
387
387
|
var _req$headers, _req$headers$authoriz;
|
388
388
|
|
389
|
-
const session = await get({
|
390
|
-
req,
|
391
|
-
createContext
|
392
|
-
});
|
393
|
-
const sudoContext = createContext({
|
394
|
-
sudo: true
|
395
|
-
});
|
396
389
|
const pathname = url__default["default"].parse(req === null || req === void 0 ? void 0 : req.url).pathname;
|
397
390
|
let nextSession;
|
398
391
|
|
@@ -400,6 +393,14 @@ function createAuth({
|
|
400
393
|
return;
|
401
394
|
}
|
402
395
|
|
396
|
+
const sudoContext = createContext({
|
397
|
+
sudo: true
|
398
|
+
});
|
399
|
+
const session = await get({
|
400
|
+
req,
|
401
|
+
createContext
|
402
|
+
});
|
403
|
+
|
403
404
|
if (((_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : (_req$headers$authoriz = _req$headers.authorization) === null || _req$headers$authoriz === void 0 ? void 0 : _req$headers$authoriz.split(' ')[0]) === 'Bearer') {
|
404
405
|
nextSession = await jwt.getToken({
|
405
406
|
req,
|
@@ -415,11 +416,11 @@ function createAuth({
|
|
415
416
|
return;
|
416
417
|
}
|
417
418
|
|
418
|
-
return _objectSpread(_objectSpread({}, nextSession), {}, {
|
419
|
+
return _objectSpread(_objectSpread(_objectSpread({}, session), nextSession), {}, {
|
419
420
|
data: nextSession.data,
|
420
421
|
listKey: nextSession.listKey,
|
421
422
|
itemId: nextSession.itemId
|
422
|
-
}
|
423
|
+
});
|
423
424
|
},
|
424
425
|
end: async ({
|
425
426
|
res,
|
@@ -385,13 +385,6 @@ function createAuth({
|
|
385
385
|
}) => {
|
386
386
|
var _req$headers, _req$headers$authoriz;
|
387
387
|
|
388
|
-
const session = await get({
|
389
|
-
req,
|
390
|
-
createContext
|
391
|
-
});
|
392
|
-
const sudoContext = createContext({
|
393
|
-
sudo: true
|
394
|
-
});
|
395
388
|
const pathname = url__default["default"].parse(req === null || req === void 0 ? void 0 : req.url).pathname;
|
396
389
|
let nextSession;
|
397
390
|
|
@@ -399,6 +392,14 @@ function createAuth({
|
|
399
392
|
return;
|
400
393
|
}
|
401
394
|
|
395
|
+
const sudoContext = createContext({
|
396
|
+
sudo: true
|
397
|
+
});
|
398
|
+
const session = await get({
|
399
|
+
req,
|
400
|
+
createContext
|
401
|
+
});
|
402
|
+
|
402
403
|
if (((_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : (_req$headers$authoriz = _req$headers.authorization) === null || _req$headers$authoriz === void 0 ? void 0 : _req$headers$authoriz.split(' ')[0]) === 'Bearer') {
|
403
404
|
nextSession = await jwt.getToken({
|
404
405
|
req,
|
@@ -414,11 +415,11 @@ function createAuth({
|
|
414
415
|
return;
|
415
416
|
}
|
416
417
|
|
417
|
-
return _objectSpread(_objectSpread({}, nextSession), {}, {
|
418
|
+
return _objectSpread(_objectSpread(_objectSpread({}, session), nextSession), {}, {
|
418
419
|
data: nextSession.data,
|
419
420
|
listKey: nextSession.listKey,
|
420
421
|
itemId: nextSession.itemId
|
421
|
-
}
|
422
|
+
});
|
422
423
|
},
|
423
424
|
end: async ({
|
424
425
|
res,
|
@@ -353,13 +353,6 @@ function createAuth({
|
|
353
353
|
}) => {
|
354
354
|
var _req$headers, _req$headers$authoriz;
|
355
355
|
|
356
|
-
const session = await get({
|
357
|
-
req,
|
358
|
-
createContext
|
359
|
-
});
|
360
|
-
const sudoContext = createContext({
|
361
|
-
sudo: true
|
362
|
-
});
|
363
356
|
const pathname = url.parse(req === null || req === void 0 ? void 0 : req.url).pathname;
|
364
357
|
let nextSession;
|
365
358
|
|
@@ -367,6 +360,14 @@ function createAuth({
|
|
367
360
|
return;
|
368
361
|
}
|
369
362
|
|
363
|
+
const sudoContext = createContext({
|
364
|
+
sudo: true
|
365
|
+
});
|
366
|
+
const session = await get({
|
367
|
+
req,
|
368
|
+
createContext
|
369
|
+
});
|
370
|
+
|
370
371
|
if (((_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : (_req$headers$authoriz = _req$headers.authorization) === null || _req$headers$authoriz === void 0 ? void 0 : _req$headers$authoriz.split(' ')[0]) === 'Bearer') {
|
371
372
|
nextSession = await getToken({
|
372
373
|
req,
|
@@ -382,11 +383,11 @@ function createAuth({
|
|
382
383
|
return;
|
383
384
|
}
|
384
385
|
|
385
|
-
return _objectSpread(_objectSpread({}, nextSession), {}, {
|
386
|
+
return _objectSpread(_objectSpread(_objectSpread({}, session), nextSession), {}, {
|
386
387
|
data: nextSession.data,
|
387
388
|
listKey: nextSession.listKey,
|
388
389
|
itemId: nextSession.itemId
|
389
|
-
}
|
390
|
+
});
|
390
391
|
},
|
391
392
|
end: async ({
|
392
393
|
res,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -198,13 +198,14 @@ export function createAuth<GeneratedListTypes extends BaseListTypeInfo>({
|
|
198
198
|
return {
|
199
199
|
...sessionStrategy,
|
200
200
|
get: async ({ req, createContext }) => {
|
201
|
-
const session = await get({ req, createContext });
|
202
|
-
const sudoContext = createContext({ sudo: true });
|
203
201
|
const pathname = url.parse(req?.url!).pathname!;
|
204
202
|
let nextSession: Session;
|
205
203
|
if (pathname.includes('/api/auth')) {
|
206
204
|
return;
|
207
205
|
}
|
206
|
+
const sudoContext = createContext({ sudo: true });
|
207
|
+
|
208
|
+
const session = await get({ req, createContext });
|
208
209
|
if (req.headers?.authorization?.split(' ')[0] === 'Bearer') {
|
209
210
|
nextSession = (await getToken({
|
210
211
|
req,
|
@@ -225,11 +226,11 @@ export function createAuth<GeneratedListTypes extends BaseListTypeInfo>({
|
|
225
226
|
return;
|
226
227
|
}
|
227
228
|
return {
|
229
|
+
...session,
|
228
230
|
...nextSession,
|
229
231
|
data: nextSession.data,
|
230
232
|
listKey: nextSession.listKey,
|
231
233
|
itemId: nextSession.itemId,
|
232
|
-
...session,
|
233
234
|
};
|
234
235
|
},
|
235
236
|
end: async ({ res, req, createContext }) => {
|