diff --git a/services/graph/mocks/ldapclient.go b/services/graph/mocks/ldapclient.go index f2c10eb75..09a57cbc4 100644 --- a/services/graph/mocks/ldapclient.go +++ b/services/graph/mocks/ldapclient.go @@ -163,6 +163,20 @@ func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, return r0, r1 } +// NTLMUnauthenticatedBind provides a mock function with given fields: domain, username +func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error { + ret := _m.Called(domain, username) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(domain, username) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // PasswordModify provides a mock function with given fields: _a0 func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) { ret := _m.Called(_a0) @@ -279,6 +293,27 @@ func (_m *Client) StartTLS(_a0 *tls.Config) error { return r0 } +// TLSConnectionState provides a mock function with given fields: +func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) { + ret := _m.Called() + + var r0 tls.ConnectionState + if rf, ok := ret.Get(0).(func() tls.ConnectionState); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(tls.ConnectionState) + } + + var r1 bool + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // UnauthenticatedBind provides a mock function with given fields: username func (_m *Client) UnauthenticatedBind(username string) error { ret := _m.Called(username) @@ -292,3 +327,17 @@ func (_m *Client) UnauthenticatedBind(username string) error { return r0 } + +// Unbind provides a mock function with given fields: +func (_m *Client) Unbind() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/services/graph/pkg/identity/ldap/reconnect.go b/services/graph/pkg/identity/ldap/reconnect.go index 8a5c405f6..0a4e92474 100644 --- a/services/graph/pkg/identity/ldap/reconnect.go +++ b/services/graph/pkg/identity/ldap/reconnect.go @@ -317,3 +317,18 @@ func (c ConnWithReconnect) Compare(dn, attribute, value string) (bool, error) { func (c ConnWithReconnect) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) { return nil, ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) } + +// NTLMUnauthenticatedBind implements the ldap.Client interface +func (c ConnWithReconnect) NTLMUnauthenticatedBind(domain, username string) error { + return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) +} + +// TLSConnectionState implements the ldap.Client interface +func (c ConnWithReconnect) TLSConnectionState() (tls.ConnectionState, bool) { + return tls.ConnectionState{}, false +} + +// Unbind implements the ldap.Client interface +func (c ConnWithReconnect) Unbind() error { + return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) +} diff --git a/services/graph/pkg/identity/ldap_test.go b/services/graph/pkg/identity/ldap_test.go index 87d0b1716..5c2aed7f6 100644 --- a/services/graph/pkg/identity/ldap_test.go +++ b/services/graph/pkg/identity/ldap_test.go @@ -14,7 +14,7 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/config" ) -// ldapMock implements the ldap.Client interfac +// ldapMock implements the ldap.Client interface type ldapMock struct { SearchFunc *searchFunc }