From 9d6934f8facab47e2a58f3357a390661071212bb Mon Sep 17 00:00:00 2001 From: xueqzhan Date: Thu, 1 Sep 2022 11:58:51 -0400 Subject: [PATCH] Add DisableAnonymous to DelegatingAuthenticationOptions Kubernetes-commit: 5619c71eb0b9fae13c831d92797da9427094518f --- pkg/server/options/authentication.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/server/options/authentication.go b/pkg/server/options/authentication.go index 8ff771af0..296d8530e 100644 --- a/pkg/server/options/authentication.go +++ b/pkg/server/options/authentication.go @@ -202,6 +202,9 @@ type DelegatingAuthenticationOptions struct { // CustomRoundTripperFn allows for specifying a middleware function for custom HTTP behaviour for the authentication webhook client. CustomRoundTripperFn transport.WrapperFunc + + // DisableAnonymous gives user an option to disable Anonymous authentication. + DisableAnonymous bool } func NewDelegatingAuthenticationOptions() *DelegatingAuthenticationOptions { @@ -283,7 +286,7 @@ func (s *DelegatingAuthenticationOptions) ApplyTo(authenticationInfo *server.Aut } cfg := authenticatorfactory.DelegatingAuthenticatorConfig{ - Anonymous: true, + Anonymous: !s.DisableAnonymous, CacheTTL: s.CacheTTL, WebhookRetryBackoff: s.WebhookRetryBackoff, TokenAccessReviewTimeout: s.TokenRequestTimeout,