Write refresh token cookies

This commit is contained in:
Stefan Kürzeder 2020-06-03 16:37:37 +02:00
parent 4a0d88d6dd
commit 86fed427e0
3 changed files with 5 additions and 5 deletions
pkg
forwardauth
httphandler

View file

@ -20,7 +20,7 @@ func getBaseCookie(options *options.Options) *http.Cookie {
Path: "/",
Domain: options.CookieDomain,
HttpOnly: true,
Secure: false,
Secure: true,
}
}

View file

@ -42,8 +42,8 @@ func (root *HttpHandler) callbackHandler(w http.ResponseWriter, r *http.Request,
http.SetCookie(w, root.forwardAuth.ClearCSRFCookie(root.options))
http.SetCookie(w, root.forwardAuth.MakeAuthCookie(root.options, authResult))
//if len(authResult.RefreshToken) > 0 { // Do we have an refresh token?
// http.SetCookie(w, root.forwardAuth.MakeRefreshAuthCookie(root.options, authResult))
//}
if len(authResult.RefreshToken) > 0 { // Do we have an refresh token?
http.SetCookie(w, root.forwardAuth.MakeRefreshAuthCookie(root.options, authResult))
}
http.Redirect(w, r, redirect, http.StatusTemporaryRedirect)
}

View file

@ -25,7 +25,7 @@ func (root *HttpHandler) rootHandler(w http.ResponseWriter, r *http.Request, for
logger.Warn("IsAuthenticated failed, initating login flow.")
http.SetCookie(w, root.forwardAuth.ClearAuthCookie(root.options))
//http.SetCookie(w, root.forwardAuth.ClearRefreshAuthCookie(root.options))
http.SetCookie(w, root.forwardAuth.ClearRefreshAuthCookie(root.options))
state := uuid.New().String()
http.SetCookie(w, root.forwardAuth.MakeCSRFCookie(w, r, root.options, state))