mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user