浏览代码

OAuth: Check both TLS client cert and key

If either is set, try to use them.

This should help avoid a situation where someone has half-configured TLS
client authentication and it doesn't work without raising an obvious
error.
Matt Bostock 8 年之前
父节点
当前提交
f2f8ca52d9
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      pkg/api/login_oauth.go

+ 1 - 1
pkg/api/login_oauth.go

@@ -81,7 +81,7 @@ func OAuthLogin(ctx *middleware.Context) {
 
 	// initialize oauth2 context
 	oauthCtx := oauth2.NoContext
-	if setting.OAuthService.OAuthInfos[name].TlsClientCert != "" {
+	if setting.OAuthService.OAuthInfos[name].TlsClientCert != "" || setting.OAuthService.OAuthInfos[name].TlsClientKey != "" {
 		cert, err := tls.LoadX509KeyPair(setting.OAuthService.OAuthInfos[name].TlsClientCert, setting.OAuthService.OAuthInfos[name].TlsClientKey)
 		if err != nil {
 			log.Fatal(err)