use current host if in prod
Some checks failed
Check / checks (push) Has been cancelled

This commit is contained in:
Gustavo Maronato 2024-03-09 14:09:14 -05:00
parent 8f8d0e095f
commit c4951ed359
No known key found for this signature in database

View File

@ -23,6 +23,7 @@ type OIDCHandler struct {
oidc *oidcservice.OIDCService
user *userservice.UserService
uiHost string
prod bool
}
func NewOIDCHandler(cfg *config.Config, oidc *oidcservice.OIDCService, user *userservice.UserService) *OIDCHandler {
@ -32,6 +33,7 @@ func NewOIDCHandler(cfg *config.Config, oidc *oidcservice.OIDCService, user *use
oidc: oidc,
user: user,
uiHost: uiHost,
prod: cfg.Prod,
}
}
@ -126,5 +128,11 @@ func (h *OIDCHandler) Callback(w http.ResponseWriter, r *http.Request) {
Host: h.uiHost,
Path: "/",
}
http.Redirect(w, r, uiURL.String(), http.StatusFound)
redirectURL := "/"
if !h.prod {
redirectURL = uiURL.String()
}
http.Redirect(w, r, redirectURL, http.StatusFound)
}