mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
refactor: fix logout logic in oidc middleware
This commit is contained in:
parent
16cb09bda5
commit
5680a306ff
1 changed files with 1 additions and 3 deletions
|
@ -65,9 +65,6 @@ func (amw *oidcMiddleware) initSlow() error {
|
|||
|
||||
amw.authMux = http.NewServeMux()
|
||||
amw.authMux.HandleFunc(auth.OIDCMiddlewareCallbackPath, authProvider.LoginCallbackHandler)
|
||||
amw.authMux.HandleFunc(auth.OIDCLogoutPath, func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||
})
|
||||
amw.authMux.HandleFunc("/", authProvider.RedirectLoginPage)
|
||||
amw.auth = authProvider
|
||||
return nil
|
||||
|
@ -82,6 +79,7 @@ func (amw *oidcMiddleware) before(w http.ResponseWriter, r *http.Request) (proce
|
|||
|
||||
if r.URL.Path == auth.OIDCLogoutPath {
|
||||
amw.auth.LogoutCallbackHandler(w, r)
|
||||
return false
|
||||
}
|
||||
if err := amw.auth.CheckToken(r); err != nil {
|
||||
if errors.Is(err, auth.ErrMissingToken) {
|
||||
|
|
Loading…
Add table
Reference in a new issue