Skip to content

Commit

Permalink
prefer cookieName as cookie split variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Jun 19, 2023
1 parent 22caafa commit 904e0cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/custom-session-jwt/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const jwtSessionStrategy = {
if (!context.req) return;

const { cookie = '' } = context.req.headers;
const [user, jwt] = cookie.split('=');
if (user !== 'user') return;
const [cookieName, jwt] = cookie.split('=');
if (cookieName !== 'user') return;

const jwtResult = await jwtVerify(jwt);
if (!jwtResult) return;
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-session/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const sillySessionStrategy = {
//
// in practice, you should use authentication for your sessions, such as OAuth or JWT
const { cookie = '' } = context.req.headers;
const [user, id] = cookie.split('=');
if (user !== 'user') return;
const [cookieName, id] = cookie.split('=');
if (cookieName !== 'user') return;

const who = await context.sudo().db.User.findOne({ where: { id } });
if (!who) return;
Expand Down
12 changes: 4 additions & 8 deletions examples/usecase-blog-moderated/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const sillySessionStrategy = {
//
// in practice, you should use authentication for your sessions, such as OAuth or JWT
const { cookie = '' } = context.req.headers;
const [user, id] = cookie.split('=');
if (user !== 'user') return;
const [cookieName, id] = cookie.split('=');
if (cookieName !== 'user') return;

const who = await context.sudo().db.User.findOne({ where: { id } });
if (!who) return;
Expand All @@ -31,12 +31,8 @@ const sillySessionStrategy = {
// context.sessionStrategy.start
// context.sessionStrategy.end
//
async start(): Promise<Session | undefined> {
return;
},
async end(): Promise<Session | undefined> {
return;
},
async start() {},
async end() {},
};

export default config<TypeInfo>({
Expand Down

0 comments on commit 904e0cc

Please sign in to comment.