-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a25f393
commit df6e880
Showing
4 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const express = require('express'); | ||
const { EventEmitter } = require('events'); | ||
const { auth } = require('../'); | ||
|
||
const app = express(); | ||
const IN_MEMORY_SESSION = {}; | ||
|
||
class Store extends EventEmitter { | ||
get (id, cb) { | ||
const val = IN_MEMORY_SESSION[id]; | ||
console.log('sessionStoreget', id, val); | ||
process.nextTick(() => cb(null, val)); | ||
} | ||
set (id, data, cb) { | ||
console.log('sessionstoreSave', id, data); | ||
IN_MEMORY_SESSION[id] = data; | ||
process.nextTick(() => cb()); | ||
} | ||
destroy (id, cb) { | ||
console.log('sessionstoreDestroy', id); | ||
delete IN_MEMORY_SESSION[id]; | ||
process.nextTick(() => cb()); | ||
} | ||
} | ||
|
||
app.use( | ||
auth({ | ||
idpLogout: true, | ||
sessionStore: Store | ||
}) | ||
); | ||
|
||
app.get('/', (req, res) => { | ||
res.send(`hello ${req.oidc.user.sub}`); | ||
}); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters