feat: auth advanced settings UI + reload auth on save
This commit is contained in:
@@ -73,7 +73,7 @@ module.exports = {
|
||||
}
|
||||
})
|
||||
WIKI.auth.strategies[stg.key] = strategy
|
||||
WIKI.logger.info(`Authentication Strategy ${stg.title}: [ OK ]`)
|
||||
WIKI.logger.info(`Authentication Strategy ${stg.key}: [ OK ]`)
|
||||
}
|
||||
} catch (err) {
|
||||
WIKI.logger.error(`Authentication Strategy: [ FAILED ]`)
|
||||
|
@@ -72,6 +72,7 @@ module.exports = {
|
||||
autoEnrollGroups: { v: str.autoEnrollGroups }
|
||||
}).where('key', str.key)
|
||||
}
|
||||
await WIKI.auth.activateStrategies()
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Strategies updated successfully')
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ module.exports = {
|
||||
if (err) { return next() }
|
||||
|
||||
// Expired but still valid within 7 days, just renew
|
||||
if (info instanceof jwt.TokenExpiredError && moment().subtract(7, 'days').isBefore(info.expiredAt)) {
|
||||
if (info instanceof jwt.TokenExpiredError && moment().subtract(14, 'days').isBefore(info.expiredAt)) {
|
||||
const jwtPayload = jwt.decode(securityHelper.extractJWT(req))
|
||||
try {
|
||||
const newToken = await WIKI.models.users.refreshToken(jwtPayload.id)
|
||||
@@ -24,7 +24,7 @@ module.exports = {
|
||||
if (req.get('content-type') === 'application/json') {
|
||||
res.headers('new-jwt', newToken.token)
|
||||
} else {
|
||||
res.cookie('jwt', newToken.token, { expires: moment().add(7, 'days').toDate() })
|
||||
res.cookie('jwt', newToken.token, { expires: moment().add(365, 'days').toDate() })
|
||||
}
|
||||
} catch (err) {
|
||||
return next()
|
||||
|
Reference in New Issue
Block a user