Implement SAML endpoints for APIv4 (#5671)
* Implement SAML endpoints for APIv4 * Fix unit test * Only disable encryption when removing puplic/private certs
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
fe38d6d5bb
Коммит
3559fb7959
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user