Implement SAML endpoints for APIv4 (#5671)

* Implement SAML endpoints for APIv4

* Fix unit test

* Only disable encryption when removing puplic/private certs
Этот коммит содержится в:
Joram Wilander
2017-03-13 08:26:23 -04:00
коммит произвёл George Goldberg
родитель fe38d6d5bb
Коммит 3559fb7959
11 изменённых файлов: 540 добавлений и 19 удалений

Просмотреть файл

@@ -3,6 +3,11 @@
package model
import (
"encoding/json"
"io"
)
const (
USER_AUTH_SERVICE_SAML = "saml"
USER_AUTH_SERVICE_SAML_TEXT = "With SAML"
@@ -16,3 +21,29 @@ type SamlAuthRequest struct {
URL string
RelayState string
}
type SamlCertificateStatus struct {
IdpCertificateFile bool `json:"idp_certificate_file"`
PrivateKeyFile bool `json:"private_key_file"`
PublicCertificateFile bool `json:"public_certificate_file"`
}
func (s *SamlCertificateStatus) ToJson() string {
b, err := json.Marshal(s)
if err != nil {
return ""
} else {
return string(b)
}
}
func SamlCertificateStatusFromJson(data io.Reader) *SamlCertificateStatus {
decoder := json.NewDecoder(data)
var status SamlCertificateStatus
err := decoder.Decode(&status)
if err == nil {
return &status
} else {
return nil
}
}