Expire abandoned OIDC mobile login sessions

This commit is contained in:
zsh committed 2026-09-25 17:38:37 +12:00
1 parent d22c468215
commit 273693e8ad
2 files changed
+28 -1

No files matched your search

+23
View File
@@ -75,3 +75,26 @@ describe('OidcAuthStrategy - isValidWebCallbackUrl', () => {
expect(strategy.isValidWebCallbackUrl('http://books.example.com/login', req)).to.equal(false)
})
})
describe('OidcAuthStrategy - openIdAuthSession', () => {
/** @type {OidcAuthStrategy} */
let strategy
beforeEach(() => {
global.RouterBasePath = ''
strategy = new OidcAuthStrategy()
})
it('configures a 10 minute TTL with autopurge so abandoned mobile logins are cleaned up', () => {
expect(strategy.openIdAuthSession.ttl).to.equal(10 * 60 * 1000)
expect(strategy.openIdAuthSession.ttlAutopurge).to.equal(true)
})
it('still supports the same set/has/get/delete usage as a plain Map', () => {
strategy.openIdAuthSession.set('some-state', { mobile_redirect_uri: 'myapp://callback' })
expect(strategy.openIdAuthSession.has('some-state')).to.equal(true)
expect(strategy.openIdAuthSession.get('some-state')).to.deep.equal({ mobile_redirect_uri: 'myapp://callback' })
strategy.openIdAuthSession.delete('some-state')
expect(strategy.openIdAuthSession.has('some-state')).to.equal(false)
})
})