2020-05-20 10:43:12 +02:00
|
|
|
package route
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
oidc "forge.cadoles.com/wpetit/goweb-oidc"
|
2020-05-20 19:23:01 +02:00
|
|
|
"forge.cadoles.com/wpetit/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)
|
2020-05-20 19:23:01 +02:00
|
|
|
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),
|
|
|
|
)
|
|
|
|
|
2020-05-20 19:23:01 +02:00
|
|
|
client.Logout(w, r, conf.OIDC.PostLogoutRedirectURL)
|
2020-05-20 10:43:12 +02:00
|
|
|
}
|