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:
		| @@ -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") | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dr. Stefan Schimanski
					Dr. Stefan Schimanski