mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
options/authentication: revert extra serviceaccount TokenGetter function silently enabling serviceaccounts
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
parent
0caeba5cbe
commit
dc0bcd62e3
@ -218,15 +218,6 @@ func (o *BuiltInAuthenticationOptions) WithServiceAccounts() *BuiltInAuthenticat
|
||||
return o
|
||||
}
|
||||
|
||||
// WithTokenGetterFunction set optional service account token getter function
|
||||
func (o *BuiltInAuthenticationOptions) WithTokenGetterFunction(f func(factory informers.SharedInformerFactory) serviceaccount.ServiceAccountTokenGetter) *BuiltInAuthenticationOptions {
|
||||
if o.ServiceAccounts == nil {
|
||||
o.ServiceAccounts = &ServiceAccountAuthenticationOptions{}
|
||||
}
|
||||
o.ServiceAccounts.OptionalTokenGetter = f
|
||||
return o
|
||||
}
|
||||
|
||||
// WithTokenFile set default value for token file authentication
|
||||
func (o *BuiltInAuthenticationOptions) WithTokenFile() *BuiltInAuthenticationOptions {
|
||||
o.TokenFile = &TokenFileAuthenticationOptions{}
|
||||
|
@ -494,16 +494,13 @@ func TestWithTokenGetterFunction(t *testing.T) {
|
||||
called = true
|
||||
return nil
|
||||
}
|
||||
opts := NewBuiltInAuthenticationOptions().WithTokenGetterFunction(f)
|
||||
opts := NewBuiltInAuthenticationOptions().WithServiceAccounts()
|
||||
opts.ServiceAccounts.OptionalTokenGetter = f
|
||||
err := opts.ApplyTo(context.Background(), &genericapiserver.AuthenticationInfo{}, nil, nil, &openapicommon.Config{}, nil, fakeClientset, versionedInformer, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if opts.ServiceAccounts.OptionalTokenGetter == nil {
|
||||
t.Fatal("expected token getter function to be set")
|
||||
}
|
||||
|
||||
if !called {
|
||||
t.Fatal("expected token getter function to be called")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user