Add missing new methods to fulfill ldap.Client interface

This commit is contained in:
Ralf Haferkamp
2022-08-02 14:55:27 +02:00
parent aaa3143cb4
commit fa36a73c54
3 changed files with 65 additions and 1 deletions

View File

@@ -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
}

View File

@@ -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"))
}

View File

@@ -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
}