Fix typo: (*App).CheckForClienSideCert to (*App).CheckForClientSideCert (#10092)
N/A - [x] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/platform/blob/master/i18n/en.json) and [.../webapp/i18n/en.json](https://github.com/mattermost/platform/tree/master/webapp/i18n/en.json)) updates
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
8e9df61934
Коммит
d9a7db0f19
@@ -1094,7 +1094,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
c.Err = model.NewAppError("ClientSideCertNotAllowed", "api.user.login.client_side_cert.license.app_error", nil, "", http.StatusBadRequest)
|
c.Err = model.NewAppError("ClientSideCertNotAllowed", "api.user.login.client_side_cert.license.app_error", nil, "", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
certPem, certSubject, certEmail := c.App.CheckForClienSideCert(r)
|
certPem, certSubject, certEmail := c.App.CheckForClientSideCert(r)
|
||||||
mlog.Debug("Client Cert", mlog.String("cert_subject", certSubject), mlog.String("cert_email", certEmail))
|
mlog.Debug("Client Cert", mlog.String("cert_subject", certSubject), mlog.String("cert_email", certEmail))
|
||||||
|
|
||||||
if len(certPem) == 0 || len(certEmail) == 0 {
|
if len(certPem) == 0 || len(certEmail) == 0 {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/mattermost/mattermost-server/store"
|
"github.com/mattermost/mattermost-server/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *App) CheckForClienSideCert(r *http.Request) (string, string, string) {
|
func (a *App) CheckForClientSideCert(r *http.Request) (string, string, string) {
|
||||||
pem := r.Header.Get("X-SSL-Client-Cert") // mapped to $ssl_client_cert from nginx
|
pem := r.Header.Get("X-SSL-Client-Cert") // mapped to $ssl_client_cert from nginx
|
||||||
subject := r.Header.Get("X-SSL-Client-Cert-Subject-DN") // mapped to $ssl_client_s_dn from nginx
|
subject := r.Header.Get("X-SSL-Client-Cert-Subject-DN") // mapped to $ssl_client_s_dn from nginx
|
||||||
email := ""
|
email := ""
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCheckForClienSideCert(t *testing.T) {
|
func TestCheckForClientSideCert(t *testing.T) {
|
||||||
th := Setup()
|
th := Setup()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ func TestCheckForClienSideCert(t *testing.T) {
|
|||||||
r.Header.Add("X-SSL-Client-Cert", tt.pem)
|
r.Header.Add("X-SSL-Client-Cert", tt.pem)
|
||||||
r.Header.Add("X-SSL-Client-Cert-Subject-DN", tt.subject)
|
r.Header.Add("X-SSL-Client-Cert-Subject-DN", tt.subject)
|
||||||
|
|
||||||
_, _, actualEmail := th.App.CheckForClienSideCert(r)
|
_, _, actualEmail := th.App.CheckForClientSideCert(r)
|
||||||
|
|
||||||
if actualEmail != tt.expectedEmail {
|
if actualEmail != tt.expectedEmail {
|
||||||
t.Fatalf("CheckForClienSideCert(%v): expected %v, actual %v", tt.subject, tt.expectedEmail, actualEmail)
|
t.Fatalf("CheckForClientSideCert(%v): expected %v, actual %v", tt.subject, tt.expectedEmail, actualEmail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user