This commit is contained in:
3wc 2022-12-07 14:57:04 -08:00
parent d5c4641074
commit 47bcf9c4ac
1 changed files with 6 additions and 3 deletions

View File

@ -56,6 +56,8 @@ module.exports = exports = (log, loga, argv) ->
if argv.oauth2_CallbackPort? if argv.oauth2_CallbackPort?
callbackHost = callbackHost + ":" + argv.oauth2_CallbackPort callbackHost = callbackHost + ":" + argv.oauth2_CallbackPort
console.log "callbackHost", callbackHost
ids = [] ids = []
# Mozilla Persona service closes on # Mozilla Persona service closes on
@ -167,7 +169,7 @@ module.exports = exports = (log, loga, argv) ->
return false return false
switch idProvider switch idProvider
when "github", "google", "twitter", 'oauth2' when "github", "google", "twitter", "oauth2"
if _.isEqual(admin[idProvider], req.session.passport.user[idProvider].id) if _.isEqual(admin[idProvider], req.session.passport.user[idProvider].id)
return true return true
else else
@ -202,12 +204,13 @@ module.exports = exports = (log, loga, argv) ->
OAuth2Strategy = require('passport-oauth2').Strategy OAuth2Strategy = require('passport-oauth2').Strategy
oauth2StrategyName = callbackHost + 'OAuth' oauth2StrategyName = callbackHost + 'OAuth'
console.log "callbackHost", callbackHost
if argv.oauth2_UserInfoURL? if argv.oauth2_UserInfoURL?
OAuth2Strategy::userProfile = (accesstoken, done) -> OAuth2Strategy::userProfile = (accesstoken, done) ->
console.log "hello"
console.log accesstoken
@_oauth2._request "GET", argv.oauth2_UserInfoURL, null, null, accesstoken, (err, data) -> @_oauth2._request "GET", argv.oauth2_UserInfoURL, null, null, accesstoken, (err, data) ->
console.log "data", data
console.log "err", err
if err if err
return done err return done err
try try