Skip to content

Commit

Permalink
Switched from 4 to http.SameSiteNoneMode
Browse files Browse the repository at this point in the history
  • Loading branch information
Espinoza, Erik committed Mar 30, 2021
1 parent 7bdc22a commit 3f6db8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/keymasterd/app.go
Expand Up @@ -601,7 +601,7 @@ func (state *RuntimeState) setNewAuthCookie(w http.ResponseWriter, username stri
return "", err
}
expiration := time.Now().Add(time.Duration(maxAgeSecondsAuthCookie) * time.Second)
authCookie := http.Cookie{Name: authCookieName, Value: cookieVal, Expires: expiration, Path: "/", HttpOnly: true, Secure: true, SameSite: 4}
authCookie := http.Cookie{Name: authCookieName, Value: cookieVal, Expires: expiration, Path: "/", HttpOnly: true, Secure: true, SameSite: http.SameSiteNoneMode}

//use handler with original request.
if w != nil {
Expand Down Expand Up @@ -629,7 +629,7 @@ func (state *RuntimeState) updateAuthCookieAuthlevel(w http.ResponseWriter, r *h
return "", err
}

updatedAuthCookie := http.Cookie{Name: authCookieName, Value: cookieVal, Expires: authCookie.Expires, Path: "/", HttpOnly: true, Secure: true, SameSite: 4}
updatedAuthCookie := http.Cookie{Name: authCookieName, Value: cookieVal, Expires: authCookie.Expires, Path: "/", HttpOnly: true, Secure: true, SameSite: http.SameSiteNoneMode}
logger.Debugf(3, "about to update authCookie")
http.SetCookie(w, &updatedAuthCookie)
return authCookie.Value, nil
Expand Down Expand Up @@ -1174,7 +1174,7 @@ func (state *RuntimeState) logoutHandler(w http.ResponseWriter, r *http.Request)

if authCookie != nil {
expiration := time.Unix(0, 0)
updatedAuthCookie := http.Cookie{Name: authCookieName, Value: "", Expires: expiration, Path: "/", HttpOnly: true, Secure: true, SameSite: 4}
updatedAuthCookie := http.Cookie{Name: authCookieName, Value: "", Expires: expiration, Path: "/", HttpOnly: true, Secure: true, SameSite: http.SameSiteNoneMode}
http.SetCookie(w, &updatedAuthCookie)
}
//redirect to login
Expand Down

0 comments on commit 3f6db8e

Please sign in to comment.