From f2f8ca52d96e9bc5120828dba125e476bd5edf49 Mon Sep 17 00:00:00 2001 From: Matt Bostock Date: Fri, 6 Oct 2017 15:03:46 +0100 Subject: [PATCH] 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. --- pkg/api/login_oauth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go index 426f3f048b4..be54a5af855 100644 --- a/pkg/api/login_oauth.go +++ b/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)