github.com/wgh-/mattermost-server@v4.8.0-rc2+incompatible/model/saml.go (about)

     1  // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  const (
    12  	USER_AUTH_SERVICE_SAML      = "saml"
    13  	USER_AUTH_SERVICE_SAML_TEXT = "With SAML"
    14  	SAML_IDP_CERTIFICATE        = 1
    15  	SAML_PRIVATE_KEY            = 2
    16  	SAML_PUBLIC_CERT            = 3
    17  )
    18  
    19  type SamlAuthRequest struct {
    20  	Base64AuthRequest string
    21  	URL               string
    22  	RelayState        string
    23  }
    24  
    25  type SamlCertificateStatus struct {
    26  	IdpCertificateFile    bool `json:"idp_certificate_file"`
    27  	PrivateKeyFile        bool `json:"private_key_file"`
    28  	PublicCertificateFile bool `json:"public_certificate_file"`
    29  }
    30  
    31  func (s *SamlCertificateStatus) ToJson() string {
    32  	b, _ := json.Marshal(s)
    33  	return string(b)
    34  }
    35  
    36  func SamlCertificateStatusFromJson(data io.Reader) *SamlCertificateStatus {
    37  	var status *SamlCertificateStatus
    38  	json.NewDecoder(data).Decode(&status)
    39  	return status
    40  }