feat: Add strict transport security and secure cookie options (#741)

This commit is contained in:
Garrett Delfosse
2022-03-31 12:31:06 -05:00
committed by GitHub
parent bb6c12ddd4
commit 0d53795c0d
3 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,8 @@ type Options struct {
AWSCertificates awsidentity.Certificates
GoogleTokenValidator *idtoken.Validator
SecureAuthCookie bool
}
// New constructs the Coder API into an HTTP handler.

View File

@ -417,6 +417,7 @@ func (api *api) postLogin(rw http.ResponseWriter, r *http.Request) {
Path: "/",
HttpOnly: true,
SameSite: http.SameSiteLaxMode,
Secure: api.SecureAuthCookie,
})
render.Status(r, http.StatusCreated)