mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 04:31:36 +08:00
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.
This commit is contained in:
@ -81,7 +81,7 @@ func OAuthLogin(ctx *middleware.Context) {
|
|||||||
|
|
||||||
// initialize oauth2 context
|
// initialize oauth2 context
|
||||||
oauthCtx := oauth2.NoContext
|
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)
|
cert, err := tls.LoadX509KeyPair(setting.OAuthService.OAuthInfos[name].TlsClientCert, setting.OAuthService.OAuthInfos[name].TlsClientKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
Reference in New Issue
Block a user