1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow oauth strategy callback method to be customised

Closes #1998

Method can be set via: `adminAuth.strategy.options.callbackMethod`

Can be either GET (default) or POST.
This commit is contained in:
Nick O'Leary 2018-12-13 13:43:57 +00:00
parent 978f4ecc58
commit a1f135bd66
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -182,7 +182,12 @@ function genericStrategy(adminApp,strategy) {
passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }), passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }),
completeGenerateStrategyAuth completeGenerateStrategyAuth
); );
adminApp.get('/auth/strategy/callback',
var callbackMethodFunc = adminApp.get;
if (/^post$/i.test(options.callbackMethod)) {
callbackMethodFunc = adminApp.post;
}
callbackMethodFunc('/auth/strategy/callback',
passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }), passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }),
completeGenerateStrategyAuth completeGenerateStrategyAuth
); );