[MM-18360] Add audit logging for SAML user login (#12831)
* Add audit logging for SAML user login * add statement for login sucess * Update web/saml.go Co-Authored-By: Martin Kraft <martin@upspin.org>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9b9923ea42
Коммит
5dbccd0f07
@@ -84,8 +84,12 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
relayProps = model.MapFromJson(strings.NewReader(stateStr))
|
relayProps = model.MapFromJson(strings.NewReader(stateStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.LogAudit("attempt")
|
||||||
|
|
||||||
action := relayProps["action"]
|
action := relayProps["action"]
|
||||||
if user, err := samlInterface.DoLogin(encodedXML, relayProps); err != nil {
|
if user, err := samlInterface.DoLogin(encodedXML, relayProps); err != nil {
|
||||||
|
c.LogAudit("fail")
|
||||||
|
|
||||||
if action == model.OAUTH_ACTION_MOBILE {
|
if action == model.OAUTH_ACTION_MOBILE {
|
||||||
err.Translate(c.App.T)
|
err.Translate(c.App.T)
|
||||||
w.Write([]byte(err.ToJson()))
|
w.Write([]byte(err.ToJson()))
|
||||||
@@ -126,12 +130,16 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.LogAuditWithUserId(user.Id, "obtained user")
|
||||||
|
|
||||||
session, err := c.App.DoLogin(w, r, user, "")
|
session, err := c.App.DoLogin(w, r, user, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Err = err
|
c.Err = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.LogAuditWithUserId(user.Id, "success")
|
||||||
|
|
||||||
c.App.AttachSessionCookies(w, r, session)
|
c.App.AttachSessionCookies(w, r, session)
|
||||||
|
|
||||||
c.App.Session = *session
|
c.App.Session = *session
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user