* add new pluginapi methods

* SAML login hook

* set ReAddRemovedMembers to true for plugin groups

* change to DoLogin signature for SAML
Этот коммит содержится в:
Ben Cooke
2025-03-13 12:00:15 -04:00
коммит произвёл GitHub
родитель 0e0e54446d
Коммит ccd8a60168
44 изменённых файлов: 2119 добавлений и 213 удалений

Просмотреть файл

@@ -12,6 +12,7 @@ import (
"time"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
"github.com/mattermost/mattermost/server/v8/channels/audit"
"github.com/mattermost/mattermost/server/v8/channels/utils"
)
@@ -135,7 +136,7 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
user, err := samlInterface.DoLogin(c.AppContext, encodedXML, relayProps)
user, assertion, err := samlInterface.DoLogin(c.AppContext, encodedXML, relayProps)
if err != nil {
c.LogAudit("fail")
handleError(err)
@@ -172,6 +173,18 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
})
}
pluginContext := &plugin.Context{
RequestId: c.AppContext.RequestId(),
SessionId: c.AppContext.Session().Id,
IPAddress: c.AppContext.IPAddress(),
AcceptLanguage: c.AppContext.AcceptLanguage(),
UserAgent: c.AppContext.UserAgent(),
}
c.App.Channels().RunMultiHook(func(hooks plugin.Hooks, manifest *model.Manifest) bool {
err := hooks.OnSAMLLogin(pluginContext, user, assertion)
return err == nil
}, plugin.OnSAMLLoginID)
auditRec.AddMeta("obtained_user_id", user.Id)
c.LogAuditWithUserId(user.Id, "obtained user")