Add option for setting Authorization header
This commit is contained in:
parent
c702e59c49
commit
7584d84986
|
@ -11,4 +11,5 @@ en:
|
|||
oauth2_json_name_path: "Path in the OAuth2 User JSON to the user's full: user.name.full"
|
||||
oauth2_json_email_path: "Path in the OAuth2 User JSON to the user's email: user.email.primary"
|
||||
oauth2_email_verified: "Check this if the OAuth2 site has verified the email"
|
||||
oauth2_send_auth_header: "Send the token as an HTTP Authorization header"
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ login:
|
|||
oauth2_json_name_path: ''
|
||||
oauth2_json_email_path: ''
|
||||
oauth2_email_verified: false
|
||||
oauth2_send_auth_header: true
|
||||
oauth2_button_title:
|
||||
default: 'with OAuth2'
|
||||
client: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# name: discourse-oauth2-basic
|
||||
# about: Generic OAuth2 Plugin
|
||||
# version: 0.1
|
||||
# version: 0.2
|
||||
# authors: Robin Ward
|
||||
|
||||
require_dependency 'auth/oauth2_authenticator.rb'
|
||||
|
@ -20,7 +20,9 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator
|
|||
authorize_url: SiteSetting.oauth2_authorize_url,
|
||||
token_url: SiteSetting.oauth2_token_url
|
||||
}
|
||||
if SiteSetting.oauth2_send_auth_header?
|
||||
opts[:token_params] = {headers: {'Authorization' => basic_auth_header }}
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue