Skip to content

Commit

Permalink
is https conf cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Aug 15, 2024
1 parent 71e0e9b commit aeda2c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ OAUTH_REDIRECT_URI=
AUTH_ST_TTL=300
AUTH_SESSION_TTL=86400
AUTH_SERVICES_LOGOUT=http://localhost:5203/api/v1/auth/sso-signout
AUTH_IS_HTTPS=false

CORS_ALLOW_ORIGINS=http://localhost:3000
2 changes: 2 additions & 0 deletions backend/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type AuthConfig struct {
STTTL int
SessionTTL int
Services []string
IsHTTPS bool
}

type CorsConfig struct {
Expand Down Expand Up @@ -84,6 +85,7 @@ func LoadConfig() (*Config, error) {
STTTL: int(STTTL),
SessionTTL: int(sessionTTL),
Services: servicesLogout,
IsHTTPS: os.Getenv("AUTH_IS_HTTPS") == "true",
}

return &Config{
Expand Down
2 changes: 1 addition & 1 deletion backend/internal/auth/auth.handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (h *handlerImpl) VerifyGoogleLogin(c context.Ctx) {
return
}

c.SetCookie("CASTGC", session.Token, h.conf.SessionTTL, "/", "localhost", false, true)
c.SetCookie("CASTGC", session.Token, h.conf.SessionTTL, "/", "localhost", h.conf.IsHTTPS, true)

c.JSON(200, &dto.ServiceTicketToken{
ServiceTicket: serviceTicket.Token,
Expand Down

0 comments on commit aeda2c8

Please sign in to comment.