feat(metrics): anonymous access when enabled in accessControl config (#4110)

* feat: add anonymouspolicy support in metrics

Signed-off-by: uaggarwa <uaggarwa@akamai.com>

* test: add unit tests

Signed-off-by: uaggarwa <uaggarwa@akamai.com>

---------

Signed-off-by: uaggarwa <uaggarwa@akamai.com>
This commit is contained in:
uaggarwa
2026-06-10 03:19:28 -04:00
committed by GitHub
parent 273b15364b
commit 66e9cfb01f
7 changed files with 334 additions and 5 deletions
+3 -1
View File
@@ -793,8 +793,10 @@ func validateAuthzPolicies(config *config.Config, logger zlog.Logger) error {
logger.Info().Msg("checking if anonymous authorization is the only type of authorization policy configured")
// if no authentication is configured, policies must be anonymous-only;
if !authConfig.IsBasicAuthnEnabled() && !config.IsMTLSAuthEnabled() && !authConfig.IsBearerAuthEnabled() &&
!accessControlConfig.ContainsOnlyAnonymousPolicy() {
!accessControlConfig.ContainsOnlyAnonymousPolicy() &&
!accessControlConfig.ContainsOnlyMetricsAnonymousPolicy() {
msg := "access control config requires one of htpasswd, ldap, openid or mTLS authentication " +
"or using only 'anonymousPolicy' policies"
logger.Error().Err(zerr.ErrBadConfig).Msg(msg)