oidc: use 'end_session_endpoint' from discovery, remove 'OIDC_LOGOUT_URL'

This commit is contained in:
yusing
2025-02-27 05:27:38 +08:00
parent 50262f2acc
commit f9b7e64d53
3 changed files with 66 additions and 31 deletions

View File

@@ -80,11 +80,12 @@ func (amw *oidcMiddleware) before(w http.ResponseWriter, r *http.Request) (proce
return false
}
if r.URL.Path == auth.OIDCLogoutPath {
amw.auth.LogoutCallbackHandler(w, r)
}
if err := amw.auth.CheckToken(r); err != nil {
if errors.Is(err, auth.ErrMissingToken) {
amw.authMux.ServeHTTP(w, r)
} else if r.URL.Path == auth.OIDCLogoutPath {
amw.auth.LogoutCallbackHandler(w, r)
} else {
auth.WriteBlockPage(w, http.StatusForbidden, err.Error(), auth.OIDCLogoutPath)
}