Oauth: Remove extra decoding of redirect url (#60875)

Oauth: remove extra decoding of redirect cookie url
This commit is contained in:
Karl Persson 2023-01-02 16:45:45 +01:00 committed by GitHub
parent 950f357175
commit 5b4e1ee6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"net/http"
"net/url"
"golang.org/x/oauth2"
@ -258,7 +257,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *models.ReqContext) {
hs.HooksService.RunLoginHook(&loginInfo, ctx)
metrics.MApiLoginOAuth.Inc()
if redirectTo, err := url.QueryUnescape(ctx.GetCookie("redirect_to")); err == nil && len(redirectTo) > 0 {
if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 {
if err := hs.ValidateRedirectTo(redirectTo); err == nil {
cookies.DeleteCookie(ctx.Resp, "redirect_to", hs.CookieOptionsFromCfg)
ctx.Redirect(redirectTo)