From 86d496c9b72c97b905bfc23d26556032c6fa1d05 Mon Sep 17 00:00:00 2001 From: enahum Date: Wed, 20 Jul 2016 17:01:10 -0400 Subject: PLT-3629 fix uploading certificates if the files in the config do not exists (#3634) --- model/client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'model/client.go') diff --git a/model/client.go b/model/client.go index b97a2f7ad..23648050f 100644 --- a/model/client.go +++ b/model/client.go @@ -1730,7 +1730,7 @@ func (c *Client) UploadCertificateFile(data []byte, contentType string) *AppErro } // Removes a x509 base64 Certificate or Private Key file used with SAML. -// filename is required. Returns nil if succesful, otherwise returns an AppError +// filename is required. Returns nil if successful, otherwise returns an AppError func (c *Client) RemoveCertificateFile(filename string) *AppError { if r, err := c.DoApiPost("/admin/remove_certificate", MapToJson(map[string]string{"filename": filename})); err != nil { return err @@ -1739,3 +1739,14 @@ func (c *Client) RemoveCertificateFile(filename string) *AppError { return nil } } + +// Checks if the x509 base64 Certificates and Private Key files used with SAML exists on the file system. +// Returns a map[string]interface{} if successful, otherwise returns an AppError. Must be System Admin authenticated. +func (c *Client) SamlCertificateStatus(filename string) (map[string]interface{}, *AppError) { + if r, err := c.DoApiGet("/admin/remove_certificate", "", ""); err != nil { + return nil, err + } else { + defer closeBody(r) + return StringInterfaceFromJson(r.Body), nil + } +} -- cgit v1.2.3-1-g7c22