goweb-oidc/internal/route/logout.go

26 lines
549 B
Go

package route
import (
"net/http"
oidc "forge.cadoles.com/cadoles/goweb-oidc"
"forge.cadoles.com/cadoles/goweb-oidc/internal/config"
"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)
}