Skip to content

Commit

Permalink
fix(auth): disable secure cookie for development
Browse files Browse the repository at this point in the history
  • Loading branch information
tithanayut committed Feb 7, 2025
1 parent 926eba3 commit ef3429e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion auth/server-session/handler/extauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ func (s *Server) ExtAuth(c echo.Context) error {
l.Warn().Msg("[Server.ExtAuth] invalid session")

// Expire the invalid session cookie
// TODO: Enable secure cookie
cookie := &http.Cookie{
Name: sessionCookieName,
Value: "",
Path: "/",
Expires: time.Unix(0, 0),
HttpOnly: true,
Secure: true,
Secure: false,
}
c.SetCookie(cookie)

Expand Down
3 changes: 2 additions & 1 deletion auth/server/handler/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ func (s *Server) Login(c echo.Context) error {
}
}

// TODO: Enable secure cookie
cookie := &http.Cookie{
Name: sessionCookieName,
Value: sessionID,
Path: "/",
HttpOnly: true,
Secure: true,
Secure: false,
}
c.SetCookie(cookie)

Expand Down
3 changes: 2 additions & 1 deletion auth/server/handler/login_with_google.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ func (s *Server) LoginWithGoogle(c echo.Context) error {
}
}

// TODO: Enable secure cookie
cookie := &http.Cookie{
Name: sessionCookieName,
Value: sessionID,
Path: "/",
HttpOnly: true,
Secure: true,
Secure: false,
}
c.SetCookie(cookie)

Expand Down
3 changes: 2 additions & 1 deletion auth/server/handler/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ func (s *Server) Logout(c echo.Context) error {
l.Error().Err(err).Msg("[Server.Logout] failed to logout, continuing to clear cookie")
}

// TODO: Enable secure cookie
cookie := &http.Cookie{
Name: sessionCookieName,
Value: "",
Path: "/",
Expires: time.Unix(0, 0),
HttpOnly: true,
Secure: true,
Secure: false,
}
c.SetCookie(cookie)

Expand Down

0 comments on commit ef3429e

Please sign in to comment.