Skip to content

Commit

Permalink
Merge pull request Place1#194 from DasSkelett/fix/auth-middleware-log…
Browse files Browse the repository at this point in the history
…ging
  • Loading branch information
DasSkelett authored Jun 15, 2022
2 parents 2c68b74 + 069f312 commit 29c783f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/authnz/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import (
"net/http"
"strconv"

"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"github.com/pkg/errors"

"github.com/freifunkMUC/wg-access-server/internal/traces"
"github.com/freifunkMUC/wg-access-server/pkg/authnz/authconfig"
"github.com/freifunkMUC/wg-access-server/pkg/authnz/authruntime"
"github.com/freifunkMUC/wg-access-server/pkg/authnz/authsession"
Expand All @@ -16,6 +14,7 @@ import (

"github.com/gorilla/mux"
"github.com/gorilla/sessions"
"github.com/pkg/errors"
)

type AuthMiddleware struct {
Expand Down Expand Up @@ -100,7 +99,7 @@ func (m *AuthMiddleware) Middleware(next http.Handler) http.Handler {
if s, err := m.runtime.GetSession(r); err == nil {
if m.claimsMiddleware != nil {
if err := m.claimsMiddleware(s.Identity); err != nil {
ctxlogrus.Extract(r.Context()).Error(errors.Wrap(err, "authz middleware failure"))
traces.Logger(r.Context()).Error(errors.Wrap(err, "authz middleware failure"))
http.Error(w, "internal server error", http.StatusInternalServerError)
return
}
Expand Down

0 comments on commit 29c783f

Please sign in to comment.