mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:07:52 +00:00
fix: delete cookies (#5885)
Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
133aec4568
commit
2e86c44aa5
@ -210,7 +210,7 @@ type cookieResponseWriter struct {
|
||||
|
||||
func (r *cookieResponseWriter) WriteHeader(status int) {
|
||||
if status >= 200 && status < 300 {
|
||||
r.accessInterceptor.DeleteExhaustedCookie(r.ResponseWriter, r.request)
|
||||
r.accessInterceptor.DeleteExhaustedCookie(r.ResponseWriter)
|
||||
}
|
||||
if status == http.StatusTooManyRequests {
|
||||
r.accessInterceptor.SetExhaustedCookie(r.ResponseWriter, r.request)
|
||||
|
@ -123,8 +123,8 @@ func (c *CookieHandler) SetEncryptedCookie(w http.ResponseWriter, name, domain s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, r *http.Request, name string) {
|
||||
c.httpSet(w, name, r.Host, "", -1)
|
||||
func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, name string) {
|
||||
c.httpSet(w, name, "", "", -1)
|
||||
}
|
||||
|
||||
func (c *CookieHandler) httpSet(w http.ResponseWriter, name, domain, value string, maxage int) {
|
||||
|
@ -77,8 +77,8 @@ func (a *AccessInterceptor) SetExhaustedCookie(writer http.ResponseWriter, reque
|
||||
a.cookieHandler.SetCookie(writer, a.limitConfig.ExhaustedCookieKey, domain, cookieValue)
|
||||
}
|
||||
|
||||
func (a *AccessInterceptor) DeleteExhaustedCookie(writer http.ResponseWriter, request *http.Request) {
|
||||
a.cookieHandler.DeleteCookie(writer, request, a.limitConfig.ExhaustedCookieKey)
|
||||
func (a *AccessInterceptor) DeleteExhaustedCookie(writer http.ResponseWriter) {
|
||||
a.cookieHandler.DeleteCookie(writer, a.limitConfig.ExhaustedCookieKey)
|
||||
}
|
||||
|
||||
func (a *AccessInterceptor) Handle(next http.Handler) http.Handler {
|
||||
@ -96,7 +96,7 @@ func (a *AccessInterceptor) Handle(next http.Handler) http.Handler {
|
||||
http.Error(wrappedWriter, "quota for authenticated requests is exhausted", http.StatusTooManyRequests)
|
||||
}
|
||||
if !limited && !a.storeOnly {
|
||||
a.DeleteExhaustedCookie(wrappedWriter, request)
|
||||
a.DeleteExhaustedCookie(wrappedWriter)
|
||||
}
|
||||
if !limited {
|
||||
next.ServeHTTP(wrappedWriter, request)
|
||||
|
@ -125,7 +125,7 @@ func Start(config Config, externalSecure bool, issuer op.IssuerFromRequest, call
|
||||
if exhausted {
|
||||
limitingAccessInterceptor.SetExhaustedCookie(w, r)
|
||||
} else {
|
||||
limitingAccessInterceptor.DeleteExhaustedCookie(w, r)
|
||||
limitingAccessInterceptor.DeleteExhaustedCookie(w)
|
||||
}
|
||||
_, err = w.Write(environmentJSON)
|
||||
logging.OnError(err).Error("error serving environment.json")
|
||||
|
Loading…
x
Reference in New Issue
Block a user