refactor: refactoring of auth middlewares

This commit is contained in:
Jonas Kaninda
2024-11-25 07:38:49 +01:00
parent f4e5bb3be2
commit dbd0974388
5 changed files with 25 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ import (
func (oauth Oauth) AuthMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if isProtectedPath(r.URL.Path, oauth.Paths) {
if isProtectedPath(r.URL.Path, oauth.Path, oauth.Paths) {
oauthConf := oauth2Config(oauth)
// Check if the user is authenticated
token, err := r.Cookie("goma.oauth")