34 lines
754 B
Go
34 lines
754 B
Go
package route
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"forge.cadoles.com/Cadoles/daddy/internal/config"
|
|
oidc "forge.cadoles.com/wpetit/goweb-oidc"
|
|
"gitlab.com/wpetit/goweb/logger"
|
|
"gitlab.com/wpetit/goweb/middleware/container"
|
|
)
|
|
|
|
func handleLogout(w http.ResponseWriter, r *http.Request) {
|
|
ctx := r.Context()
|
|
ctn := container.Must(ctx)
|
|
conf := config.Must(ctn)
|
|
client := oidc.Must(ctn)
|
|
|
|
logger.Info(
|
|
ctx,
|
|
"logging out user",
|
|
logger.F("postLogoutURL", conf.OIDC.PostLogoutRedirectURL),
|
|
)
|
|
|
|
client.Logout(w, r, conf.OIDC.PostLogoutRedirectURL)
|
|
}
|
|
|
|
func handleLogoutRedirect(w http.ResponseWriter, r *http.Request) {
|
|
ctx := r.Context()
|
|
ctn := container.Must(ctx)
|
|
conf := config.Must(ctn)
|
|
|
|
http.Redirect(w, r, conf.HTTP.FrontendURL, http.StatusSeeOther)
|
|
}
|