diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index d6fd81b..1d9a88a 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -12,8 +12,11 @@ en: oauth2_json_username_path: 'Path in the OAuth2 User JSON to the username. eg: user.username' 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_json_avatar_path: "Path in the Oauth2 User JSON to the user's avatar: user.avatar_url" 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" oauth2_debug_auth: "Include rich debugging information in your logs" oauth2_authorize_options: "When authorizing request these options" + oauth2_scope: "When authorizing request this scope" + oauth2_button_title: "The text for the OAuth2 button" diff --git a/config/settings.yml b/config/settings.yml index c83e826..29f27d8 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -30,6 +30,7 @@ login: oauth2_authorize_options: default: 'scope' type: list + oauth2_scope: '' oauth2_button_title: default: 'with OAuth2' client: true diff --git a/plugin.rb b/plugin.rb index 10b3d4b..e7dfe70 100644 --- a/plugin.rb +++ b/plugin.rb @@ -40,6 +40,9 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator if SiteSetting.oauth2_send_auth_header? opts[:token_params] = { headers: { 'Authorization' => basic_auth_header } } end + unless SiteSetting.oauth2_scope.blank? + opts[:scope] = SiteSetting.oauth2_scope + end } end