коммит произвёл
GitHub
родитель
7988810fc0
Коммит
c554bbd977
@@ -3823,6 +3823,10 @@
|
|||||||
"id": "api.user.authorize_oauth_user.response.app_error",
|
"id": "api.user.authorize_oauth_user.response.app_error",
|
||||||
"translation": "Received invalid response from OAuth service provider."
|
"translation": "Received invalid response from OAuth service provider."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "api.user.authorize_oauth_user.saml_response_too_long.app_error",
|
||||||
|
"translation": "SAML response is too long"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.user.authorize_oauth_user.service.app_error",
|
"id": "api.user.authorize_oauth_user.service.app_error",
|
||||||
"translation": "Token request to {{.Service}} failed."
|
"translation": "Token request to {{.Service}} failed."
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import (
|
|||||||
"github.com/mattermost/mattermost-server/v6/utils"
|
"github.com/mattermost/mattermost-server/v6/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxSAMLResponseSize = 2 * 1024 * 1024 // 2MB
|
||||||
|
|
||||||
func (w *Web) InitSaml() {
|
func (w *Web) InitSaml() {
|
||||||
w.MainRouter.Handle("/login/sso/saml", w.APIHandler(loginWithSaml)).Methods("GET")
|
w.MainRouter.Handle("/login/sso/saml", w.APIHandler(loginWithSaml)).Methods("GET")
|
||||||
w.MainRouter.Handle("/login/sso/saml", w.APIHandlerTrustRequester(completeSaml)).Methods("POST")
|
w.MainRouter.Handle("/login/sso/saml", w.APIHandlerTrustRequester(completeSaml)).Methods("POST")
|
||||||
@@ -122,6 +124,13 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(encodedXML) > maxSAMLResponseSize {
|
||||||
|
err := model.NewAppError("completeSaml", "api.user.authorize_oauth_user.saml_response_too_long.app_error", nil, "SAML response is too long", http.StatusBadRequest)
|
||||||
|
mlog.Error(err.Error())
|
||||||
|
handleError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
user, err := samlInterface.DoLogin(c.AppContext, encodedXML, relayProps)
|
user, err := samlInterface.DoLogin(c.AppContext, encodedXML, relayProps)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.LogAudit("fail")
|
c.LogAudit("fail")
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user