summaryrefslogtreecommitdiffstats
path: root/model/saml.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-13 08:26:23 -0400
committerGeorge Goldberg <george@gberg.me>2017-03-13 12:26:23 +0000
commit3559fb7959cf008b038239f2e7c43e604c44cd31 (patch)
tree159fdbb16a169926e0d142aa17d6086fcded62c4 /model/saml.go
parentfe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81 (diff)
downloadchat-3559fb7959cf008b038239f2e7c43e604c44cd31.tar.gz
chat-3559fb7959cf008b038239f2e7c43e604c44cd31.tar.bz2
chat-3559fb7959cf008b038239f2e7c43e604c44cd31.zip
Implement SAML endpoints for APIv4 (#5671)
* Implement SAML endpoints for APIv4 * Fix unit test * Only disable encryption when removing puplic/private certs
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
+ }
+}