mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-27 03:31:46 +00:00
fixed server crash because of unregistered openidconnect strategy
This commit is contained in:
parent
5a6609150c
commit
339883405f
2 changed files with 15 additions and 9 deletions
|
|
@ -260,16 +260,22 @@ class Server {
|
|||
|
||||
app.post('/logout', this.authMiddleware.bind(this), this.logout.bind(this))
|
||||
|
||||
app.get("/oidc/login", passport.authenticate('openidconnect'))
|
||||
app.get("/oidc/login", (() => {
|
||||
if (!this.db.SSOSettings.isOIDCConfigured) return (req, res) => res.redirect("/");
|
||||
return passport.authenticate('openidconnect')
|
||||
})())
|
||||
|
||||
app.get("/oidc/callback",
|
||||
passport.authenticate('openidconnect', { failureRedirect: '/oidc/login', failureMessage: true }),
|
||||
async (req, res) => {
|
||||
const token = this.auth.generateAccessToken({ userId: req.user.id })
|
||||
res.cookie('sso', true, { httpOnly: false /* TODO: Set secure: true */ });
|
||||
(() => {
|
||||
if (!this.db.SSOSettings.isOIDCConfigured) return (req, res) => res.redirect("/");
|
||||
return passport.authenticate('openidconnect', { failureRedirect: '/oidc/login', failureMessage: true }),
|
||||
async (req, res) => {
|
||||
const token = this.auth.generateAccessToken({ userId: req.user.id })
|
||||
res.cookie('sso', true, { httpOnly: false /* TODO: Set secure: true */ });
|
||||
|
||||
res.redirect('/');
|
||||
}
|
||||
res.redirect('/');
|
||||
}
|
||||
})()
|
||||
)
|
||||
|
||||
app.get('/ping', (req, res) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue