AuthN: Make client params part of the identity (#61050)

* AuthN: Change client params to be a return value of authenticate

* AuthN: move client params to be part of the identity
This commit is contained in:
Karl Persson
2023-01-05 20:17:41 +01:00
committed by GitHub
parent 183397194a
commit cdd7392f68
14 changed files with 91 additions and 128 deletions

View File

@@ -13,19 +13,16 @@ type FakeService struct {
var _ authn.Client = new(FakeClient)
type FakeClient struct {
ExpectedErr error
ExpectedTest bool
ExpectedIdentity *authn.Identity
ExpectedErr error
ExpectedTest bool
ExpectedIdentity *authn.Identity
ExpectedClientParams *authn.ClientParams
}
func (f *FakeClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error) {
return f.ExpectedIdentity, f.ExpectedErr
}
func (f *FakeClient) ClientParams() *authn.ClientParams {
return &authn.ClientParams{}
}
func (f *FakeClient) Test(ctx context.Context, r *authn.Request) bool {
return f.ExpectedTest
}

View File

@@ -10,7 +10,6 @@ var _ authn.Client = new(MockClient)
type MockClient struct {
AuthenticateFunc func(ctx context.Context, r *authn.Request) (*authn.Identity, error)
ClientParamsFunc func() *authn.ClientParams
TestFunc func(ctx context.Context, r *authn.Request) bool
}
@@ -21,13 +20,6 @@ func (m MockClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.
return nil, nil
}
func (m MockClient) ClientParams() *authn.ClientParams {
if m.ClientParamsFunc != nil {
return m.ClientParamsFunc()
}
return nil
}
func (m MockClient) Test(ctx context.Context, r *authn.Request) bool {
if m.TestFunc != nil {
return m.TestFunc(ctx, r)