diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-08-02 12:53:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 12:53:01 -0700 |
commit | 873e4f49038746b71ab9997fc10c89192ec1cd16 (patch) | |
tree | cd4e2232792f2c4ff82941a3a6297d78c94555bb /app/oauth.go | |
parent | 76bfd279b34f960149dba15424593dfd5fbfb956 (diff) | |
parent | fa3dd6a84bb51e8a5c3d3183bdb692386bb77c5a (diff) | |
download | chat-873e4f49038746b71ab9997fc10c89192ec1cd16.tar.gz chat-873e4f49038746b71ab9997fc10c89192ec1cd16.tar.bz2 chat-873e4f49038746b71ab9997fc10c89192ec1cd16.zip |
Merge pull request #7085 from saturninoabril/merge-4.0.2
Merge 4.0.2
Diffstat (limited to 'app/oauth.go')
-rw-r--r-- | app/oauth.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/oauth.go b/app/oauth.go index c93882d4d..4174f8146 100644 --- a/app/oauth.go +++ b/app/oauth.go @@ -624,25 +624,25 @@ func AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, s expectedToken, err := GetOAuthStateToken(stateProps["token"]) if err != nil { - return nil, "", nil, err + return nil, "", stateProps, err } stateEmail := stateProps["email"] stateAction := stateProps["action"] if stateAction == model.OAUTH_ACTION_EMAIL_TO_SSO && stateEmail == "" { - return nil, "", nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) + return nil, "", stateProps, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) } cookieValue := "" if cookie, err := r.Cookie(COOKIE_OAUTH); err != nil { - return nil, "", nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) + return nil, "", stateProps, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) } else { cookieValue = cookie.Value } expectedTokenExtra := generateOAuthStateTokenExtra(stateEmail, stateAction, cookieValue) if expectedTokenExtra != expectedToken.Extra { - return nil, "", nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) + return nil, "", stateProps, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.invalid_state.app_error", nil, "", http.StatusBadRequest) } DeleteToken(expectedToken) @@ -674,7 +674,7 @@ func AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, s var ar *model.AccessResponse var bodyBytes []byte if resp, err := utils.HttpClient().Do(req); err != nil { - return nil, "", nil, model.NewLocAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.token_failed.app_error", nil, err.Error()) + return nil, "", stateProps, model.NewLocAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.token_failed.app_error", nil, err.Error()) } else { bodyBytes, _ = ioutil.ReadAll(resp.Body) resp.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes)) @@ -703,7 +703,7 @@ func AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, s req.Header.Set("Authorization", "Bearer "+ar.AccessToken) if resp, err := utils.HttpClient().Do(req); err != nil { - return nil, "", nil, model.NewLocAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", + return nil, "", stateProps, model.NewLocAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", map[string]interface{}{"Service": service}, err.Error()) } else { return resp.Body, teamId, stateProps, nil |