summaryrefslogtreecommitdiffstats
path: root/model/saml.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/saml.go')
-rw-r--r--model/saml.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/model/saml.go b/model/saml.go
index 16d3845da..1371c433f 100644
--- a/model/saml.go
+++ b/model/saml.go
@@ -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
+ }
+}