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
12
api/admin.go
12
api/admin.go
@@ -383,7 +383,7 @@ func addCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
fileData := fileArray[0]
|
||||
|
||||
if err := app.AddSamlCertificate(fileData); err != nil {
|
||||
if err := app.WriteSamlFile(fileData); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
@@ -393,7 +393,7 @@ func addCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
func removeCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
props := model.MapFromJson(r.Body)
|
||||
|
||||
if err := app.RemoveSamlCertificate(props["filename"]); err != nil {
|
||||
if err := app.RemoveSamlFile(props["filename"]); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
@@ -403,7 +403,13 @@ func removeCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func samlCertificateStatus(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
status := app.GetSamlCertificateStatus()
|
||||
w.Write([]byte(model.StringInterfaceToJson(status)))
|
||||
|
||||
statusMap := map[string]interface{}{}
|
||||
statusMap["IdpCertificateFile"] = status.IdpCertificateFile
|
||||
statusMap["PrivateKeyFile"] = status.PrivateKeyFile
|
||||
statusMap["PublicCertificateFile"] = status.PublicCertificateFile
|
||||
|
||||
w.Write([]byte(model.StringInterfaceToJson(statusMap)))
|
||||
}
|
||||
|
||||
func getRecentlyActiveUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -6,6 +6,7 @@ package api
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/platform/api4"
|
||||
"github.com/mattermost/platform/app"
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/store"
|
||||
@@ -43,6 +44,7 @@ func SetupEnterprise() *TestHelper {
|
||||
InitRouter()
|
||||
app.StartServer()
|
||||
utils.InitHTML()
|
||||
api4.InitApi(false)
|
||||
InitApi()
|
||||
utils.EnableDebugLogForTest()
|
||||
app.Srv.Store.MarkSystemRanUnitTests()
|
||||
|
||||
Ссылка в новой задаче
Block a user