Skip to content

Commit

Permalink
fix: Metrics should be protected behind authZ
Browse files Browse the repository at this point in the history
Signed-off-by: Alexei Dodon <[email protected]>
  • Loading branch information
adodon2go committed Oct 15, 2023
1 parent fc2380b commit fc826a5
Show file tree
Hide file tree
Showing 16 changed files with 8,860 additions and 8,399 deletions.
7 changes: 6 additions & 1 deletion examples/config-metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
},
"http": {
"address": "127.0.0.1",
"port": "8080"
"port": "8080",
"auth": {
"htpasswd": {
"path": "test/data/htpasswd"
}
}
},
"log": {
"level": "debug"
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func AuthHandler(ctlr *Controller) mux.MiddlewareFunc {
return bearerAuthHandler(ctlr)
}

return authnMiddleware.TryAuthnHandlers(ctlr)
return authnMiddleware.tryAuthnHandlers(ctlr)
}

func (amw *AuthnMiddleware) sessionAuthn(ctlr *Controller, userAc *reqCtx.UserAccessControl,
Expand Down Expand Up @@ -250,7 +250,7 @@ func (amw *AuthnMiddleware) basicAuthn(ctlr *Controller, userAc *reqCtx.UserAcce
return false, nil
}

func (amw *AuthnMiddleware) TryAuthnHandlers(ctlr *Controller) mux.MiddlewareFunc { //nolint: gocyclo
func (amw *AuthnMiddleware) tryAuthnHandlers(ctlr *Controller) mux.MiddlewareFunc { //nolint: gocyclo
// no password based authN, if neither LDAP nor HTTP BASIC is enabled
if !ctlr.Config.IsBasicAuthnEnabled() {
return noPasswdAuth(ctlr)
Expand Down
Loading

0 comments on commit fc826a5

Please sign in to comment.