goweb-oidc/internal/route/logout.go

26 lines
549 B
Go
Raw Permalink Normal View History

2020-05-20 10:43:12 +02:00
package route
import (
"net/http"
oidc "forge.cadoles.com/cadoles/goweb-oidc"
"forge.cadoles.com/cadoles/goweb-oidc/internal/config"
2020-05-22 16:03:59 +02:00
"gitlab.com/wpetit/goweb/logger"
2020-05-20 10:43:12 +02:00
"gitlab.com/wpetit/goweb/middleware/container"
)
func handleLogout(w http.ResponseWriter, r *http.Request) {
2020-05-22 16:03:59 +02:00
ctx := r.Context()
ctn := container.Must(ctx)
conf := config.Must(ctn)
2020-05-20 10:43:12 +02:00
client := oidc.Must(ctn)
2020-05-22 16:03:59 +02:00
logger.Info(
ctx,
"logging out user",
logger.F("postLogoutURL", conf.OIDC.PostLogoutRedirectURL),
)
client.Logout(w, r, conf.OIDC.PostLogoutRedirectURL)
2020-05-20 10:43:12 +02:00
}