From e6b157916158b5dc02e8e58c87fd561981a27895 Mon Sep 17 00:00:00 2001 From: Mart Aarma Date: Thu, 31 Mar 2022 00:00:55 +0300 Subject: [PATCH] fix: test coverage --- consent/handler_test.go | 140 ++++++- consent/manager_mock_test.go | 762 +++++++++++++++++++++++++++++++++++ driver/registry.go | 1 + driver/registry_base.go | 6 + 4 files changed, 898 insertions(+), 11 deletions(-) create mode 100644 consent/manager_mock_test.go diff --git a/consent/handler_test.go b/consent/handler_test.go index 3965536a168..2ae9e662399 100644 --- a/consent/handler_test.go +++ b/consent/handler_test.go @@ -32,6 +32,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" "github.com/tidwall/gjson" @@ -225,6 +228,7 @@ func TestGetConsentRequest(t *testing.T) { } func TestDeleteConsentSession(t *testing.T) { + newWg := func(add int) *sync.WaitGroup { var wg sync.WaitGroup wg.Add(add) @@ -238,7 +242,9 @@ func TestDeleteConsentSession(t *testing.T) { cl := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{"login-session-1"}, backChannelWG) performLoginFlow(t, reg, "1", cl) performLoginFlow(t, reg, "2", cl) - performDeleteConsentSession(t, reg, "client-1", "login-session-1", true) + + performDeleteConsentSession(t, reg, "client-1", "login-session-1", true, false) + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) require.Nil(t, c1) @@ -255,7 +261,9 @@ func TestDeleteConsentSession(t *testing.T) { cl := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{}, backChannelWG) performLoginFlow(t, reg, "1", cl) performLoginFlow(t, reg, "2", cl) - performDeleteConsentSession(t, reg, "client-1", "login-session-1", false) + + performDeleteConsentSession(t, reg, "client-1", "login-session-1", false, false) + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) require.Nil(t, c1) @@ -265,6 +273,32 @@ func TestDeleteConsentSession(t *testing.T) { backChannelWG.Wait() }) + t.Run("case=subject=subject-1,client=client-1,session=session-1,expect revoke error", func(t *testing.T) { + conf := internal.NewConfigurationWithDefaults() + reg := internal.NewRegistryMemory(t, conf) + ctrl := gomock.NewController(t) + persister := reg.Persister() + mockPersister := NewMockManager(ctrl) + defer ctrl.Finish() + mockPersister.EXPECT().RevokeSubjectClientLoginSessionConsentSession(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("SqlError")) + backChannelWG := newWg(0) + cl := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{"login-session-1"}, backChannelWG) + performLoginFlow(t, reg, "1", cl) + performLoginFlow(t, reg, "2", cl) + + reg.WithPersister(mockPersister) + performDeleteConsentSession(t, reg, "client-1", "login-session-1", false, true) + reg.WithPersister(persister) + + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") + require.NoError(t, err) + require.NotNil(t, c1) + c2, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-2") + require.NoError(t, err) + require.NotNil(t, c2) + backChannelWG.Wait() + }) + t.Run("case=subject=subject-1,client=client-1,trigger_back_channel_logout=true", func(t *testing.T) { conf := internal.NewConfigurationWithDefaults() reg := internal.NewRegistryMemory(t, conf) @@ -273,7 +307,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl) performLoginFlow(t, reg, "2", cl) - performDeleteConsentSession(t, reg, "client-1", nil, true) + performDeleteConsentSession(t, reg, "client-1", nil, true, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -292,7 +326,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl) performLoginFlow(t, reg, "2", cl) - performDeleteConsentSession(t, reg, "client-1", nil, false) + performDeleteConsentSession(t, reg, "client-1", nil, false, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -303,6 +337,32 @@ func TestDeleteConsentSession(t *testing.T) { backChannelWG.Wait() }) + t.Run("case=subject=subject-1,client=client-1,expect revoke error", func(t *testing.T) { + conf := internal.NewConfigurationWithDefaults() + reg := internal.NewRegistryMemory(t, conf) + ctrl := gomock.NewController(t) + persister := reg.Persister() + mockPersister := NewMockManager(ctrl) + defer ctrl.Finish() + mockPersister.EXPECT().RevokeSubjectClientConsentSession(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("SqlError")) + backChannelWG := newWg(0) + cl := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{"login-session-1"}, backChannelWG) + performLoginFlow(t, reg, "1", cl) + performLoginFlow(t, reg, "2", cl) + + reg.WithPersister(mockPersister) + performDeleteConsentSession(t, reg, "client-1", nil, false, true) + reg.WithPersister(persister) + + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") + require.NoError(t, err) + require.NotNil(t, c1) + c2, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-2") + require.NoError(t, err) + require.NotNil(t, c2) + backChannelWG.Wait() + }) + t.Run("case=subject=subject-1,all=true,session=session-1,trigger_back_channel_logout=true", func(t *testing.T) { conf := internal.NewConfigurationWithDefaults() reg := internal.NewRegistryMemory(t, conf) @@ -312,7 +372,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl1) performLoginFlow(t, reg, "2", cl2) - performDeleteConsentSession(t, reg, nil, "login-session-1", true) + performDeleteConsentSession(t, reg, nil, "login-session-1", true, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -332,7 +392,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl1) performLoginFlow(t, reg, "2", cl2) - performDeleteConsentSession(t, reg, nil, "login-session-1", false) + performDeleteConsentSession(t, reg, nil, "login-session-1", false, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -343,6 +403,33 @@ func TestDeleteConsentSession(t *testing.T) { backChannelWG.Wait() }) + t.Run("case=subject=subject-1,all=true,session=session-1,expect revoke error", func(t *testing.T) { + conf := internal.NewConfigurationWithDefaults() + reg := internal.NewRegistryMemory(t, conf) + ctrl := gomock.NewController(t) + persister := reg.Persister() + mockPersister := NewMockManager(ctrl) + defer ctrl.Finish() + mockPersister.EXPECT().RevokeLoginSessionConsentSession(gomock.Any(), gomock.Any()).Return(errors.New("SqlError")) + backChannelWG := newWg(0) + cl1 := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{}, backChannelWG) + cl2 := createClientWithBackChannelEndpoint(t, reg, "client-2", []string{}, backChannelWG) + performLoginFlow(t, reg, "1", cl1) + performLoginFlow(t, reg, "2", cl2) + + reg.WithPersister(mockPersister) + performDeleteConsentSession(t, reg, nil, "login-session-1", false, true) + reg.WithPersister(persister) + + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") + require.NoError(t, err) + require.NotNil(t, c1) + c2, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-2") + require.NoError(t, err) + require.NotNil(t, c2) + backChannelWG.Wait() + }) + t.Run("case=subject=subject-1,all=true,trigger_back_channel_logout=true", func(t *testing.T) { conf := internal.NewConfigurationWithDefaults() reg := internal.NewRegistryMemory(t, conf) @@ -352,7 +439,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl1) performLoginFlow(t, reg, "2", cl2) - performDeleteConsentSession(t, reg, nil, nil, true) + performDeleteConsentSession(t, reg, nil, nil, true, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -372,7 +459,7 @@ func TestDeleteConsentSession(t *testing.T) { performLoginFlow(t, reg, "1", cl1) performLoginFlow(t, reg, "2", cl2) - performDeleteConsentSession(t, reg, nil, nil, false) + performDeleteConsentSession(t, reg, nil, nil, false, false) c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") require.Error(t, x.ErrNotFound, err) @@ -382,9 +469,36 @@ func TestDeleteConsentSession(t *testing.T) { require.Nil(t, c2) backChannelWG.Wait() }) + + t.Run("case=subject=subject-1,all=true,expect revoke error", func(t *testing.T) { + conf := internal.NewConfigurationWithDefaults() + reg := internal.NewRegistryMemory(t, conf) + ctrl := gomock.NewController(t) + persister := reg.Persister() + mockPersister := NewMockManager(ctrl) + defer ctrl.Finish() + mockPersister.EXPECT().RevokeSubjectConsentSession(gomock.Any(), gomock.Any()).Return(errors.New("SqlError")) + backChannelWG := newWg(0) + cl1 := createClientWithBackChannelEndpoint(t, reg, "client-1", []string{}, backChannelWG) + cl2 := createClientWithBackChannelEndpoint(t, reg, "client-2", []string{}, backChannelWG) + performLoginFlow(t, reg, "1", cl1) + performLoginFlow(t, reg, "2", cl2) + + reg.WithPersister(mockPersister) + performDeleteConsentSession(t, reg, nil, nil, false, true) + reg.WithPersister(persister) + + c1, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-1") + require.NoError(t, err) + require.NotNil(t, c1) + c2, err := reg.ConsentManager().GetConsentRequest(context.Background(), "consent-challenge-2") + require.NoError(t, err) + require.NotNil(t, c2) + backChannelWG.Wait() + }) } -func performDeleteConsentSession(t *testing.T, reg driver.Registry, client, loginSessionId interface{}, triggerBackChannelLogout bool) { +func performDeleteConsentSession(t *testing.T, reg driver.Registry, client, loginSessionId interface{}, triggerBackChannelLogout bool, expectError bool) { h := NewHandler(reg, reg.Config()) r := x.NewRouterAdmin() h.SetRoutes(r) @@ -410,8 +524,12 @@ func performDeleteConsentSession(t *testing.T, reg driver.Registry, client, logi req, err := http.NewRequest(http.MethodDelete, u.String(), nil) require.NoError(t, err) - _, err = c.Do(req) - require.NoError(t, err) + res, err := c.Do(req) + if expectError { + require.Equal(t, 500, res.StatusCode) + } else { + require.Equal(t, 204, res.StatusCode) + } } func performLoginFlow(t *testing.T, reg driver.Registry, flowId string, cl *client.Client) { diff --git a/consent/manager_mock_test.go b/consent/manager_mock_test.go new file mode 100644 index 00000000000..6101af28c0a --- /dev/null +++ b/consent/manager_mock_test.go @@ -0,0 +1,762 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: consent/manager.go +// Package mock_consent is a generated GoMock package. +package consent_test + +import ( + context "context" + reflect "reflect" + time "time" + + "github.com/gobuffalo/pop/v6" + "gopkg.in/square/go-jose.v2" + + "github.com/ory/fosite" + "github.com/ory/hydra/consent" + "github.com/ory/hydra/oauth2/trust" + "github.com/ory/x/popx" + + gomock "github.com/golang/mock/gomock" + + client "github.com/ory/hydra/client" +) + +// MockManager is a mock of Manager interface. +type MockManager struct { + ctrl *gomock.Controller + recorder *MockManagerMockRecorder +} + +// MockManagerMockRecorder is the mock recorder for MockManager. +type MockManagerMockRecorder struct { + mock *MockManager +} + +// NewMockManager creates a new mock instance. +func NewMockManager(ctrl *gomock.Controller) *MockManager { + mock := &MockManager{ctrl: ctrl} + mock.recorder = &MockManagerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManager) EXPECT() *MockManagerMockRecorder { + return m.recorder +} + +// AcceptLogoutRequest mocks base method. +func (m *MockManager) AcceptLogoutRequest(ctx context.Context, challenge string) (*consent.LogoutRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AcceptLogoutRequest", ctx, challenge) + ret0, _ := ret[0].(*consent.LogoutRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AcceptLogoutRequest indicates an expected call of AcceptLogoutRequest. +func (mr *MockManagerMockRecorder) AcceptLogoutRequest(ctx, challenge interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptLogoutRequest", reflect.TypeOf((*MockManager)(nil).AcceptLogoutRequest), ctx, challenge) +} + +// ConfirmLoginSession mocks base method. +func (m *MockManager) ConfirmLoginSession(ctx context.Context, id string, authTime time.Time, subject string, remember bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfirmLoginSession", ctx, id, authTime, subject, remember) + ret0, _ := ret[0].(error) + return ret0 +} + +// ConfirmLoginSession indicates an expected call of ConfirmLoginSession. +func (mr *MockManagerMockRecorder) ConfirmLoginSession(ctx, id, authTime, subject, remember interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfirmLoginSession", reflect.TypeOf((*MockManager)(nil).ConfirmLoginSession), ctx, id, authTime, subject, remember) +} + +// CountSubjectsGrantedConsentRequests mocks base method. +func (m *MockManager) CountSubjectsGrantedConsentRequests(ctx context.Context, user string) (int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CountSubjectsGrantedConsentRequests", ctx, user) + ret0, _ := ret[0].(int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CountSubjectsGrantedConsentRequests indicates an expected call of CountSubjectsGrantedConsentRequests. +func (mr *MockManagerMockRecorder) CountSubjectsGrantedConsentRequests(ctx, user interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountSubjectsGrantedConsentRequests", reflect.TypeOf((*MockManager)(nil).CountSubjectsGrantedConsentRequests), ctx, user) +} + +// CreateConsentRequest mocks base method. +func (m *MockManager) CreateConsentRequest(ctx context.Context, req *consent.ConsentRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateConsentRequest", ctx, req) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateConsentRequest indicates an expected call of CreateConsentRequest. +func (mr *MockManagerMockRecorder) CreateConsentRequest(ctx, req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateConsentRequest", reflect.TypeOf((*MockManager)(nil).CreateConsentRequest), ctx, req) +} + +// CreateForcedObfuscatedLoginSession mocks base method. +func (m *MockManager) CreateForcedObfuscatedLoginSession(ctx context.Context, session *consent.ForcedObfuscatedLoginSession) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateForcedObfuscatedLoginSession", ctx, session) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateForcedObfuscatedLoginSession indicates an expected call of CreateForcedObfuscatedLoginSession. +func (mr *MockManagerMockRecorder) CreateForcedObfuscatedLoginSession(ctx, session interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateForcedObfuscatedLoginSession", reflect.TypeOf((*MockManager)(nil).CreateForcedObfuscatedLoginSession), ctx, session) +} + +// CreateLoginRequest mocks base method. +func (m *MockManager) CreateLoginRequest(ctx context.Context, req *consent.LoginRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateLoginRequest", ctx, req) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateLoginRequest indicates an expected call of CreateLoginRequest. +func (mr *MockManagerMockRecorder) CreateLoginRequest(ctx, req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoginRequest", reflect.TypeOf((*MockManager)(nil).CreateLoginRequest), ctx, req) +} + +// CreateLoginSession mocks base method. +func (m *MockManager) CreateLoginSession(ctx context.Context, session *consent.LoginSession) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateLoginSession", ctx, session) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateLoginSession indicates an expected call of CreateLoginSession. +func (mr *MockManagerMockRecorder) CreateLoginSession(ctx, session interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoginSession", reflect.TypeOf((*MockManager)(nil).CreateLoginSession), ctx, session) +} + +// CreateLogoutRequest mocks base method. +func (m *MockManager) CreateLogoutRequest(ctx context.Context, request *consent.LogoutRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateLogoutRequest", ctx, request) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateLogoutRequest indicates an expected call of CreateLogoutRequest. +func (mr *MockManagerMockRecorder) CreateLogoutRequest(ctx, request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLogoutRequest", reflect.TypeOf((*MockManager)(nil).CreateLogoutRequest), ctx, request) +} + +// DeleteLoginSession mocks base method. +func (m *MockManager) DeleteLoginSession(ctx context.Context, id string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteLoginSession", ctx, id) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteLoginSession indicates an expected call of DeleteLoginSession. +func (mr *MockManagerMockRecorder) DeleteLoginSession(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoginSession", reflect.TypeOf((*MockManager)(nil).DeleteLoginSession), ctx, id) +} + +// FindGrantedAndRememberedConsentRequests mocks base method. +func (m *MockManager) FindGrantedAndRememberedConsentRequests(ctx context.Context, client, user string) ([]consent.HandledConsentRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindGrantedAndRememberedConsentRequests", ctx, client, user) + ret0, _ := ret[0].([]consent.HandledConsentRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindGrantedAndRememberedConsentRequests indicates an expected call of FindGrantedAndRememberedConsentRequests. +func (mr *MockManagerMockRecorder) FindGrantedAndRememberedConsentRequests(ctx, client, user interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindGrantedAndRememberedConsentRequests", reflect.TypeOf((*MockManager)(nil).FindGrantedAndRememberedConsentRequests), ctx, client, user) +} + +// FindSubjectsGrantedConsentRequests mocks base method. +func (m *MockManager) FindSubjectsGrantedConsentRequests(ctx context.Context, user string, limit, offset int) ([]consent.HandledConsentRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindSubjectsGrantedConsentRequests", ctx, user, limit, offset) + ret0, _ := ret[0].([]consent.HandledConsentRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindSubjectsGrantedConsentRequests indicates an expected call of FindSubjectsGrantedConsentRequests. +func (mr *MockManagerMockRecorder) FindSubjectsGrantedConsentRequests(ctx, user, limit, offset interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindSubjectsGrantedConsentRequests", reflect.TypeOf((*MockManager)(nil).FindSubjectsGrantedConsentRequests), ctx, user, limit, offset) +} + +// GetConsentRequest mocks base method. +func (m *MockManager) GetConsentRequest(ctx context.Context, challenge string) (*consent.ConsentRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetConsentRequest", ctx, challenge) + ret0, _ := ret[0].(*consent.ConsentRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetConsentRequest indicates an expected call of GetConsentRequest. +func (mr *MockManagerMockRecorder) GetConsentRequest(ctx, challenge interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConsentRequest", reflect.TypeOf((*MockManager)(nil).GetConsentRequest), ctx, challenge) +} + +// GetForcedObfuscatedLoginSession mocks base method. +func (m *MockManager) GetForcedObfuscatedLoginSession(ctx context.Context, client, obfuscated string) (*consent.ForcedObfuscatedLoginSession, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetForcedObfuscatedLoginSession", ctx, client, obfuscated) + ret0, _ := ret[0].(*consent.ForcedObfuscatedLoginSession) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetForcedObfuscatedLoginSession indicates an expected call of GetForcedObfuscatedLoginSession. +func (mr *MockManagerMockRecorder) GetForcedObfuscatedLoginSession(ctx, client, obfuscated interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForcedObfuscatedLoginSession", reflect.TypeOf((*MockManager)(nil).GetForcedObfuscatedLoginSession), ctx, client, obfuscated) +} + +// GetLoginRequest mocks base method. +func (m *MockManager) GetLoginRequest(ctx context.Context, challenge string) (*consent.LoginRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLoginRequest", ctx, challenge) + ret0, _ := ret[0].(*consent.LoginRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLoginRequest indicates an expected call of GetLoginRequest. +func (mr *MockManagerMockRecorder) GetLoginRequest(ctx, challenge interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoginRequest", reflect.TypeOf((*MockManager)(nil).GetLoginRequest), ctx, challenge) +} + +// GetLogoutRequest mocks base method. +func (m *MockManager) GetLogoutRequest(ctx context.Context, challenge string) (*consent.LogoutRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLogoutRequest", ctx, challenge) + ret0, _ := ret[0].(*consent.LogoutRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLogoutRequest indicates an expected call of GetLogoutRequest. +func (mr *MockManagerMockRecorder) GetLogoutRequest(ctx, challenge interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogoutRequest", reflect.TypeOf((*MockManager)(nil).GetLogoutRequest), ctx, challenge) +} + +// GetRememberedLoginSession mocks base method. +func (m *MockManager) GetRememberedLoginSession(ctx context.Context, id string) (*consent.LoginSession, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRememberedLoginSession", ctx, id) + ret0, _ := ret[0].(*consent.LoginSession) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRememberedLoginSession indicates an expected call of GetRememberedLoginSession. +func (mr *MockManagerMockRecorder) GetRememberedLoginSession(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRememberedLoginSession", reflect.TypeOf((*MockManager)(nil).GetRememberedLoginSession), ctx, id) +} + +// HandleConsentRequest mocks base method. +func (m *MockManager) HandleConsentRequest(ctx context.Context, challenge string, r *consent.HandledConsentRequest) (*consent.ConsentRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HandleConsentRequest", ctx, challenge, r) + ret0, _ := ret[0].(*consent.ConsentRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HandleConsentRequest indicates an expected call of HandleConsentRequest. +func (mr *MockManagerMockRecorder) HandleConsentRequest(ctx, challenge, r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleConsentRequest", reflect.TypeOf((*MockManager)(nil).HandleConsentRequest), ctx, challenge, r) +} + +// HandleLoginRequest mocks base method. +func (m *MockManager) HandleLoginRequest(ctx context.Context, challenge string, r *consent.HandledLoginRequest) (*consent.LoginRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HandleLoginRequest", ctx, challenge, r) + ret0, _ := ret[0].(*consent.LoginRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HandleLoginRequest indicates an expected call of HandleLoginRequest. +func (mr *MockManagerMockRecorder) HandleLoginRequest(ctx, challenge, r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleLoginRequest", reflect.TypeOf((*MockManager)(nil).HandleLoginRequest), ctx, challenge, r) +} + +// ListUserAuthenticatedClientsWithBackChannelLogout mocks base method. +func (m *MockManager) ListUserAuthenticatedClientsWithBackChannelLogout(ctx context.Context, subject string) ([]client.LoginSessionClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserAuthenticatedClientsWithBackChannelLogout", ctx, subject) + ret0, _ := ret[0].([]client.LoginSessionClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserAuthenticatedClientsWithBackChannelLogout indicates an expected call of ListUserAuthenticatedClientsWithBackChannelLogout. +func (mr *MockManagerMockRecorder) ListUserAuthenticatedClientsWithBackChannelLogout(ctx, subject interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserAuthenticatedClientsWithBackChannelLogout", reflect.TypeOf((*MockManager)(nil).ListUserAuthenticatedClientsWithBackChannelLogout), ctx, subject) +} + +// ListUserSessionAuthenticatedClientsWithBackChannelLogout mocks base method. +func (m *MockManager) ListUserSessionAuthenticatedClientsWithBackChannelLogout(ctx context.Context, subject, sid string) ([]client.LoginSessionClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserSessionAuthenticatedClientsWithBackChannelLogout", ctx, subject, sid) + ret0, _ := ret[0].([]client.LoginSessionClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserSessionAuthenticatedClientsWithBackChannelLogout indicates an expected call of ListUserSessionAuthenticatedClientsWithBackChannelLogout. +func (mr *MockManagerMockRecorder) ListUserSessionAuthenticatedClientsWithBackChannelLogout(ctx, subject, sid interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserSessionAuthenticatedClientsWithBackChannelLogout", reflect.TypeOf((*MockManager)(nil).ListUserSessionAuthenticatedClientsWithBackChannelLogout), ctx, subject, sid) +} + +// ListUserSessionAuthenticatedClientsWithFrontChannelLogout mocks base method. +func (m *MockManager) ListUserSessionAuthenticatedClientsWithFrontChannelLogout(ctx context.Context, subject, sid string) ([]client.LoginSessionClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserSessionAuthenticatedClientsWithFrontChannelLogout", ctx, subject, sid) + ret0, _ := ret[0].([]client.LoginSessionClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserSessionAuthenticatedClientsWithFrontChannelLogout indicates an expected call of ListUserSessionAuthenticatedClientsWithFrontChannelLogout. +func (mr *MockManagerMockRecorder) ListUserSessionAuthenticatedClientsWithFrontChannelLogout(ctx, subject, sid interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserSessionAuthenticatedClientsWithFrontChannelLogout", reflect.TypeOf((*MockManager)(nil).ListUserSessionAuthenticatedClientsWithFrontChannelLogout), ctx, subject, sid) +} + +// RejectLogoutRequest mocks base method. +func (m *MockManager) RejectLogoutRequest(ctx context.Context, challenge string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RejectLogoutRequest", ctx, challenge) + ret0, _ := ret[0].(error) + return ret0 +} + +// RejectLogoutRequest indicates an expected call of RejectLogoutRequest. +func (mr *MockManagerMockRecorder) RejectLogoutRequest(ctx, challenge interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RejectLogoutRequest", reflect.TypeOf((*MockManager)(nil).RejectLogoutRequest), ctx, challenge) +} + +// RevokeLoginSessionConsentSession mocks base method. +func (m *MockManager) RevokeLoginSessionConsentSession(ctx context.Context, loginSessionId string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeLoginSessionConsentSession", ctx, loginSessionId) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeLoginSessionConsentSession indicates an expected call of RevokeLoginSessionConsentSession. +func (mr *MockManagerMockRecorder) RevokeLoginSessionConsentSession(ctx, loginSessionId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeLoginSessionConsentSession", reflect.TypeOf((*MockManager)(nil).RevokeLoginSessionConsentSession), ctx, loginSessionId) +} + +// RevokeSubjectClientConsentSession mocks base method. +func (m *MockManager) RevokeSubjectClientConsentSession(ctx context.Context, user, client string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeSubjectClientConsentSession", ctx, user, client) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeSubjectClientConsentSession indicates an expected call of RevokeSubjectClientConsentSession. +func (mr *MockManagerMockRecorder) RevokeSubjectClientConsentSession(ctx, user, client interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeSubjectClientConsentSession", reflect.TypeOf((*MockManager)(nil).RevokeSubjectClientConsentSession), ctx, user, client) +} + +// RevokeSubjectClientLoginSessionConsentSession mocks base method. +func (m *MockManager) RevokeSubjectClientLoginSessionConsentSession(ctx context.Context, user, client, loginSessionId string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeSubjectClientLoginSessionConsentSession", ctx, user, client, loginSessionId) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeSubjectClientLoginSessionConsentSession indicates an expected call of RevokeSubjectClientLoginSessionConsentSession. +func (mr *MockManagerMockRecorder) RevokeSubjectClientLoginSessionConsentSession(ctx, user, client, loginSessionId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeSubjectClientLoginSessionConsentSession", reflect.TypeOf((*MockManager)(nil).RevokeSubjectClientLoginSessionConsentSession), ctx, user, client, loginSessionId) +} + +// RevokeSubjectConsentSession mocks base method. +func (m *MockManager) RevokeSubjectConsentSession(ctx context.Context, user string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeSubjectConsentSession", ctx, user) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeSubjectConsentSession indicates an expected call of RevokeSubjectConsentSession. +func (mr *MockManagerMockRecorder) RevokeSubjectConsentSession(ctx, user interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeSubjectConsentSession", reflect.TypeOf((*MockManager)(nil).RevokeSubjectConsentSession), ctx, user) +} + +// RevokeSubjectLoginSession mocks base method. +func (m *MockManager) RevokeSubjectLoginSession(ctx context.Context, user string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeSubjectLoginSession", ctx, user) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeSubjectLoginSession indicates an expected call of RevokeSubjectLoginSession. +func (mr *MockManagerMockRecorder) RevokeSubjectLoginSession(ctx, user interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeSubjectLoginSession", reflect.TypeOf((*MockManager)(nil).RevokeSubjectLoginSession), ctx, user) +} + +// VerifyAndInvalidateConsentRequest mocks base method. +func (m *MockManager) VerifyAndInvalidateConsentRequest(ctx context.Context, verifier string) (*consent.HandledConsentRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VerifyAndInvalidateConsentRequest", ctx, verifier) + ret0, _ := ret[0].(*consent.HandledConsentRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VerifyAndInvalidateConsentRequest indicates an expected call of VerifyAndInvalidateConsentRequest. +func (mr *MockManagerMockRecorder) VerifyAndInvalidateConsentRequest(ctx, verifier interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyAndInvalidateConsentRequest", reflect.TypeOf((*MockManager)(nil).VerifyAndInvalidateConsentRequest), ctx, verifier) +} + +// VerifyAndInvalidateLoginRequest mocks base method. +func (m *MockManager) VerifyAndInvalidateLoginRequest(ctx context.Context, verifier string) (*consent.HandledLoginRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VerifyAndInvalidateLoginRequest", ctx, verifier) + ret0, _ := ret[0].(*consent.HandledLoginRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VerifyAndInvalidateLoginRequest indicates an expected call of VerifyAndInvalidateLoginRequest. +func (mr *MockManagerMockRecorder) VerifyAndInvalidateLoginRequest(ctx, verifier interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyAndInvalidateLoginRequest", reflect.TypeOf((*MockManager)(nil).VerifyAndInvalidateLoginRequest), ctx, verifier) +} + +// VerifyAndInvalidateLogoutRequest mocks base method. +func (m *MockManager) VerifyAndInvalidateLogoutRequest(ctx context.Context, verifier string) (*consent.LogoutRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VerifyAndInvalidateLogoutRequest", ctx, verifier) + ret0, _ := ret[0].(*consent.LogoutRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VerifyAndInvalidateLogoutRequest indicates an expected call of VerifyAndInvalidateLogoutRequest. +func (mr *MockManagerMockRecorder) VerifyAndInvalidateLogoutRequest(ctx, verifier interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyAndInvalidateLogoutRequest", reflect.TypeOf((*MockManager)(nil).VerifyAndInvalidateLogoutRequest), ctx, verifier) +} + +func (m *MockManager) CreateClient(ctx context.Context, c *client.Client) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) UpdateClient(ctx context.Context, c *client.Client) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteClient(ctx context.Context, id string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetClients(ctx context.Context, filters client.Filter) ([]client.Client, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CountClients(ctx context.Context) (int, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetConcreteClient(ctx context.Context, id string) (*client.Client, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) Authenticate(ctx context.Context, id string, secret []byte) (*client.Client, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetClient(ctx context.Context, id string) (fosite.Client, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) ClientAssertionJWTValid(ctx context.Context, jti string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) SetClientAssertionJWT(ctx context.Context, jti string, exp time.Time) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreateAuthorizeCodeSession(ctx context.Context, code string, request fosite.Requester) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetAuthorizeCodeSession(ctx context.Context, code string, session fosite.Session) (request fosite.Requester, err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) InvalidateAuthorizeCodeSession(ctx context.Context, code string) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreateAccessTokenSession(ctx context.Context, signature string, request fosite.Requester) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteAccessTokenSession(ctx context.Context, signature string) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteRefreshTokenSession(ctx context.Context, signature string) (err error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreateOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) (fosite.Requester, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreatePKCERequestSession(ctx context.Context, signature string, requester fosite.Requester) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeletePKCERequestSession(ctx context.Context, signature string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetPublicKey(ctx context.Context, issuer string, subject string, keyId string) (*jose.JSONWebKey, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetPublicKeys(ctx context.Context, issuer string, subject string) (*jose.JSONWebKeySet, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetPublicKeyScopes(ctx context.Context, issuer string, subject string, keyId string) ([]string, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) IsJWTUsed(ctx context.Context, jti string) (bool, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) MarkJWTUsedForTime(ctx context.Context, jti string, exp time.Time) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) RevokeRefreshToken(ctx context.Context, requestID string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) RevokeAccessToken(ctx context.Context, requestID string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) FlushInactiveAccessTokens(ctx context.Context, notAfter time.Time, limit int, batchSize int) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) FlushInactiveLoginConsentRequests(ctx context.Context, notAfter time.Time, limit int, batchSize int) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteAccessTokens(ctx context.Context, clientID string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) FlushInactiveRefreshTokens(ctx context.Context, notAfter time.Time, limit int, batchSize int) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteOpenIDConnectSession(ctx context.Context, authorizeCode string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GenerateAndPersistKeySet(ctx context.Context, set, kid, alg, use string) (*jose.JSONWebKeySet, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) AddKey(ctx context.Context, set string, key *jose.JSONWebKey) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) AddKeySet(ctx context.Context, set string, keys *jose.JSONWebKeySet) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) UpdateKey(ctx context.Context, set string, key *jose.JSONWebKey) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) UpdateKeySet(ctx context.Context, set string, keys *jose.JSONWebKeySet) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetKey(ctx context.Context, set, kid string) (*jose.JSONWebKeySet, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetKeySet(ctx context.Context, set string) (*jose.JSONWebKeySet, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteKey(ctx context.Context, set, kid string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteKeySet(ctx context.Context, set string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CreateGrant(ctx context.Context, g trust.Grant, publicKey jose.JSONWebKey) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetConcreteGrant(ctx context.Context, id string) (trust.Grant, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) DeleteGrant(ctx context.Context, id string) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) GetGrants(ctx context.Context, limit, offset int, optionalIssuer string) ([]trust.Grant, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) CountGrants(ctx context.Context) (int, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) FlushInactiveGrants(ctx context.Context, notAfter time.Time, limit int, batchSize int) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) MigrationStatus(ctx context.Context) (popx.MigrationStatuses, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) MigrateDown(ctx context.Context, i int) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) MigrateUp(ctx context.Context) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) PrepareMigration(ctx context.Context) error { + //TODO implement me + panic("implement me") +} + +func (m *MockManager) Connection(ctx context.Context) *pop.Connection { + //TODO implement me + panic("implement me") +} diff --git a/driver/registry.go b/driver/registry.go index 4bea95f01b4..664f7851476 100644 --- a/driver/registry.go +++ b/driver/registry.go @@ -64,6 +64,7 @@ type Registry interface { OAuth2HMACStrategy() *foauth2.HMACSHAStrategy WithOAuth2Provider(f fosite.OAuth2Provider) WithConsentStrategy(c consent.Strategy) + WithPersister(p persistence.Persister) WithHsmContext(h hsm.Context) } diff --git a/driver/registry_base.go b/driver/registry_base.go index c83ff61a51f..b8a49c1c1c9 100644 --- a/driver/registry_base.go +++ b/driver/registry_base.go @@ -503,6 +503,11 @@ func (m *RegistryBase) WithConsentStrategy(c consent.Strategy) { m.cos = c } +// WithPersister forces a persister which is only used for testing. +func (m *RegistryBase) WithPersister(p persistence.Persister) { + m.persister = p +} + func (m *RegistryBase) AccessRequestHooks() []oauth2.AccessRequestHook { if m.arhs == nil { m.arhs = []oauth2.AccessRequestHook{ @@ -512,6 +517,7 @@ func (m *RegistryBase) AccessRequestHooks() []oauth2.AccessRequestHook { return m.arhs } +// WithHsmContext forces a hsm context which is only used for testing. func (m *RegistryBase) WithHsmContext(h hsm.Context) { m.hsm = h }