we need more logging and somehow some stuff is being suppressed
This commit is contained in:
parent
870361be98
commit
5bf30f90c2
11
plugin.rb
11
plugin.rb
|
@ -48,16 +48,18 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator
|
|||
end
|
||||
end
|
||||
|
||||
def debug(info)
|
||||
def log(info)
|
||||
Rails.logger.warn("OAuth2 Debugging: #{info}") if SiteSetting.oauth2_debug_auth
|
||||
end
|
||||
|
||||
def fetch_user_details(token)
|
||||
user_json_url = SiteSetting.oauth2_user_json_url.sub(':token', token)
|
||||
debug("user_json_url: #{user_json_url}")
|
||||
|
||||
log("user_json_url: #{user_json_url}")
|
||||
|
||||
user_json = JSON.parse(open(user_json_url, 'Authorization' => "Bearer #{token}" ).read)
|
||||
|
||||
debug("user_json: #{user_json}")
|
||||
log("user_json: #{user_json}")
|
||||
|
||||
result = {}
|
||||
if user_json.present?
|
||||
|
@ -71,7 +73,8 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator
|
|||
end
|
||||
|
||||
def after_authenticate(auth)
|
||||
debug("auth response \n\n#{auth}")
|
||||
log("after_authenticate response: \n\n#{auth}")
|
||||
|
||||
result = Auth::Result.new
|
||||
token = auth['credentials']['token']
|
||||
user_details = fetch_user_details(token)
|
||||
|
|
Loading…
Reference in New Issue