Parcourir la source

grafana/grafana#1781 add oauth api url as config

William Wei il y a 10 ans
Parent
commit
d048e39cde
3 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 2 0
      conf/defaults.ini
  2. 2 0
      conf/sample.ini
  3. 1 0
      pkg/social/social.go

+ 2 - 0
conf/defaults.ini

@@ -141,6 +141,7 @@ client_secret = some_secret
 scopes = user:email
 scopes = user:email
 auth_url = https://github.com/login/oauth/authorize
 auth_url = https://github.com/login/oauth/authorize
 token_url = https://github.com/login/oauth/access_token
 token_url = https://github.com/login/oauth/access_token
+api_url = https://api.github.com/user
 # Uncomment bellow to only allow specific email domains
 # Uncomment bellow to only allow specific email domains
 ; allowed_domains = mycompany.com othercompany.com
 ; allowed_domains = mycompany.com othercompany.com
 
 
@@ -152,6 +153,7 @@ client_secret = some_client_secret
 scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
 scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
 auth_url = https://accounts.google.com/o/oauth2/auth
 auth_url = https://accounts.google.com/o/oauth2/auth
 token_url = https://accounts.google.com/o/oauth2/token
 token_url = https://accounts.google.com/o/oauth2/token
+api_url = https://www.googleapis.com/oauth2/v1/userinfo
 allowed_domains =
 allowed_domains =
 
 
 #################################### Logging ##########################
 #################################### Logging ##########################

+ 2 - 0
conf/sample.ini

@@ -141,6 +141,7 @@
 ;scopes = user:email
 ;scopes = user:email
 ;auth_url = https://github.com/login/oauth/authorize
 ;auth_url = https://github.com/login/oauth/authorize
 ;token_url = https://github.com/login/oauth/access_token
 ;token_url = https://github.com/login/oauth/access_token
+;api_url = https://api.github.com/user
 # Uncomment bellow to only allow specific email domains
 # Uncomment bellow to only allow specific email domains
 ; allowed_domains = mycompany.com othercompany.com
 ; allowed_domains = mycompany.com othercompany.com
 
 
@@ -152,6 +153,7 @@
 ;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
 ;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
 ;auth_url = https://accounts.google.com/o/oauth2/auth
 ;auth_url = https://accounts.google.com/o/oauth2/auth
 ;token_url = https://accounts.google.com/o/oauth2/token
 ;token_url = https://accounts.google.com/o/oauth2/token
+;api_url = https://www.googleapis.com/oauth2/v1/userinfo
 # Uncomment bellow to only allow specific email domains
 # Uncomment bellow to only allow specific email domains
 ; allowed_domains = mycompany.com othercompany.com
 ; allowed_domains = mycompany.com othercompany.com
 
 

+ 1 - 0
pkg/social/social.go

@@ -49,6 +49,7 @@ func NewOAuthService() {
 			Scopes:         sec.Key("scopes").Strings(" "),
 			Scopes:         sec.Key("scopes").Strings(" "),
 			AuthUrl:        sec.Key("auth_url").String(),
 			AuthUrl:        sec.Key("auth_url").String(),
 			TokenUrl:       sec.Key("token_url").String(),
 			TokenUrl:       sec.Key("token_url").String(),
+			APIUrl:         sec.Key("api_url").String(),
 			Enabled:        sec.Key("enabled").MustBool(),
 			Enabled:        sec.Key("enabled").MustBool(),
 			AllowedDomains: sec.Key("allowed_domains").Strings(" "),
 			AllowedDomains: sec.Key("allowed_domains").Strings(" "),
 		}
 		}