Use error from OnSamlLogin (#30745)
Этот коммит содержится в:
@@ -182,10 +182,16 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
AcceptLanguage: c.AppContext.AcceptLanguage(),
|
AcceptLanguage: c.AppContext.AcceptLanguage(),
|
||||||
UserAgent: c.AppContext.UserAgent(),
|
UserAgent: c.AppContext.UserAgent(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hookErr error
|
||||||
c.App.Channels().RunMultiHook(func(hooks plugin.Hooks, manifest *model.Manifest) bool {
|
c.App.Channels().RunMultiHook(func(hooks plugin.Hooks, manifest *model.Manifest) bool {
|
||||||
err := hooks.OnSAMLLogin(pluginContext, user, assertion)
|
hookErr = hooks.OnSAMLLogin(pluginContext, user, assertion)
|
||||||
return err == nil
|
return hookErr == nil
|
||||||
}, plugin.OnSAMLLoginID)
|
}, plugin.OnSAMLLoginID)
|
||||||
|
if hookErr != nil {
|
||||||
|
handleError(model.NewAppError("completeSaml", "api.user.authorize_oauth_user.saml_hook_error.app_error", nil, "", http.StatusInternalServerError).Wrap(hookErr))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
auditRec.AddMeta("obtained_user_id", user.Id)
|
auditRec.AddMeta("obtained_user_id", user.Id)
|
||||||
c.LogAuditWithUserId(user.Id, "obtained user")
|
c.LogAuditWithUserId(user.Id, "obtained user")
|
||||||
|
|||||||
@@ -3922,6 +3922,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_hook_error.app_error",
|
||||||
|
"translation": "An error occurred in the OnSamlLogin hook. Please contact your System Administrator."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.user.authorize_oauth_user.saml_response_too_long.app_error",
|
"id": "api.user.authorize_oauth_user.saml_response_too_long.app_error",
|
||||||
"translation": "SAML response is too long"
|
"translation": "SAML response is too long"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user