Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): interact redirect #2832

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions packages/auth/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,22 @@ export class App {
signed: true,
store: {
async get(key) {
return await redis.hgetall(key)
const s = await redis.get(key)

if (!s) return null

return JSON.parse(s)
},
async set(key, session) {
// Add a delay to cookie age to ensure redis record expires after cookie
const expireInMs = maxAgeMs + 10 * 1000
const op = redis.multi()
op.hset(key, session)
op.set(key, JSON.stringify(session))
op.expire(key, expireInMs)
await op.exec()
},
async destroy(key) {
await redis.hdel(key)
await redis.del(key)
}
}
},
Expand Down Expand Up @@ -441,17 +445,6 @@ export class App {

koa.use(cors())
koa.keys = [this.config.cookieKey]
koa.use(
session(
{
key: 'sessionId',
maxAge: 60 * 1000,
signed: true
},
koa
)
)

Comment on lines -444 to -454
Copy link
Contributor

@BlairCurrey BlairCurrey Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anywhere. looks like a potential copy/paste artifact from the recent(ish) factoring out of interaction routes into the startInteractionServer ('/grant/:id/:nonce/:choice', '/grant/{id}/{nonce}').

koa.use(router.middleware())
koa.use(router.routes())

Expand Down
1 change: 0 additions & 1 deletion packages/auth/src/interaction/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ async function startInteraction(

const trx = await Interaction.startTransaction()
try {
// TODO: also establish session in redis with short expiry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed with Nathan this was just about moving sessions into Redis so its no longer a TODO

await grantService.markPending(interaction.id, trx)
await trx.commit()

Expand Down
Loading