mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: additional options for SSO plugins
+checkState property, pass Boolean false to skip nonce checking +callbackMethod, default 'get', you can pass in 'post', etc.
This commit is contained in:
@@ -74,8 +74,12 @@ Auth.reloadRoutes = function (router, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
router.get(strategy.callbackURL, function (req, res, next) {
|
||||
// Ensure the passed-back state value is identical to the saved ssoState
|
||||
router[strategy.callbackMethod || 'get'](strategy.callbackURL, function (req, res, next) {
|
||||
// Ensure the passed-back state value is identical to the saved ssoState (unless explicitly skipped)
|
||||
if (strategy.checkState === false) {
|
||||
return next();
|
||||
}
|
||||
|
||||
next(req.query.state !== req.session.ssoState ? new Error('[[error:csrf-invalid]]') : null);
|
||||
}, function (req, res, next) {
|
||||
// Trigger registration interstitial checks
|
||||
|
||||
Reference in New Issue
Block a user