diff --git a/docs/content/en/contributing/development/environment.md b/docs/content/en/contributing/development/environment.md index 008b87fc5..356ea2e42 100644 --- a/docs/content/en/contributing/development/environment.md +++ b/docs/content/en/contributing/development/environment.md @@ -23,6 +23,7 @@ In order to build and contribute to __Authelia__, you need to make sure the foll * Backend Development: * [go] *(v1.20 or greater)* * [gcc] + * [gomock] * Frontend Development * [Node.js] *(v18 or greater)* * [pnpm] @@ -95,6 +96,7 @@ listed subdomains from your browser, and they will be served by the reverse prox [Buildkite]: https://buildkite.com/ [React]: https://reactjs.org/ [go]: https://go.dev/dl/ +[gomock]: https://github.com/golang/mock [Node.js]: https://nodejs.org/en/download/ [pnpm]: https://pnpm.io/installation [Docker]: https://docs.docker.com/get-docker/ diff --git a/internal/authentication/ldap_client_mock.go b/internal/authentication/ldap_client_mock.go index 3b6b3f0fd..c58b602a2 100644 --- a/internal/authentication/ldap_client_mock.go +++ b/internal/authentication/ldap_client_mock.go @@ -205,6 +205,63 @@ func (mr *MockLDAPClientMockRecorder) ModifyWithResult(arg0 interface{}) *gomock return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ModifyWithResult", reflect.TypeOf((*MockLDAPClient)(nil).ModifyWithResult), arg0) } +// NTLMBind mocks base method. +func (m *MockLDAPClient) NTLMBind(arg0, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NTLMBind", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// NTLMBind indicates an expected call of NTLMBind. +func (mr *MockLDAPClientMockRecorder) NTLMBind(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NTLMBind", reflect.TypeOf((*MockLDAPClient)(nil).NTLMBind), arg0, arg1, arg2) +} + +// NTLMBindWithHash mocks base method. +func (m *MockLDAPClient) NTLMBindWithHash(arg0, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NTLMBindWithHash", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// NTLMBindWithHash indicates an expected call of NTLMBindWithHash. +func (mr *MockLDAPClientMockRecorder) NTLMBindWithHash(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NTLMBindWithHash", reflect.TypeOf((*MockLDAPClient)(nil).NTLMBindWithHash), arg0, arg1, arg2) +} + +// NTLMChallengeBind mocks base method. +func (m *MockLDAPClient) NTLMChallengeBind(arg0 *ldap.NTLMBindRequest) (*ldap.NTLMBindResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NTLMChallengeBind", arg0) + ret0, _ := ret[0].(*ldap.NTLMBindResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NTLMChallengeBind indicates an expected call of NTLMChallengeBind. +func (mr *MockLDAPClientMockRecorder) NTLMChallengeBind(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NTLMChallengeBind", reflect.TypeOf((*MockLDAPClient)(nil).NTLMChallengeBind), arg0) +} + +// NTLMUnauthenticatedBind mocks base method. +func (m *MockLDAPClient) NTLMUnauthenticatedBind(arg0, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NTLMUnauthenticatedBind", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// NTLMUnauthenticatedBind indicates an expected call of NTLMUnauthenticatedBind. +func (mr *MockLDAPClientMockRecorder) NTLMUnauthenticatedBind(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NTLMUnauthenticatedBind", reflect.TypeOf((*MockLDAPClient)(nil).NTLMUnauthenticatedBind), arg0, arg1) +} + // PasswordModify mocks base method. func (m *MockLDAPClient) PasswordModify(arg0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) { m.ctrl.T.Helper() diff --git a/internal/authentication/types.go b/internal/authentication/types.go index 33ef180da..7c2828f8f 100644 --- a/internal/authentication/types.go +++ b/internal/authentication/types.go @@ -28,25 +28,29 @@ type LDAPClient interface { Unbind() (err error) Bind(username, password string) (err error) - SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (bindResult *ldap.SimpleBindResult, err error) + SimpleBind(request *ldap.SimpleBindRequest) (result *ldap.SimpleBindResult, err error) MD5Bind(host string, username string, password string) (err error) - DigestMD5Bind(digestMD5BindRequest *ldap.DigestMD5BindRequest) (digestMD5BindResult *ldap.DigestMD5BindResult, err error) + DigestMD5Bind(request *ldap.DigestMD5BindRequest) (result *ldap.DigestMD5BindResult, err error) UnauthenticatedBind(username string) (err error) ExternalBind() (err error) + NTLMBind(domain string, username string, password string) (err error) + NTLMUnauthenticatedBind(domain string, username string) (err error) + NTLMBindWithHash(domain string, username string, hash string) (err error) + NTLMChallengeBind(request *ldap.NTLMBindRequest) (result *ldap.NTLMBindResult, err error) - Modify(modifyRequest *ldap.ModifyRequest) (err error) - ModifyWithResult(modifyRequest *ldap.ModifyRequest) (modifyResult *ldap.ModifyResult, err error) + Modify(request *ldap.ModifyRequest) (err error) + ModifyWithResult(request *ldap.ModifyRequest) (result *ldap.ModifyResult, err error) ModifyDN(m *ldap.ModifyDNRequest) (err error) - PasswordModify(pwdModifyRequest *ldap.PasswordModifyRequest) (pwdModifyResult *ldap.PasswordModifyResult, err error) + PasswordModify(request *ldap.PasswordModifyRequest) (result *ldap.PasswordModifyResult, err error) - Add(addRequest *ldap.AddRequest) (err error) - Del(delRequest *ldap.DelRequest) (err error) + Add(request *ldap.AddRequest) (err error) + Del(request *ldap.DelRequest) (err error) - Search(searchRequest *ldap.SearchRequest) (searchResult *ldap.SearchResult, err error) - SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (searchResult *ldap.SearchResult, err error) + Search(request *ldap.SearchRequest) (result *ldap.SearchResult, err error) + SearchWithPaging(request *ldap.SearchRequest, pagingSize uint32) (result *ldap.SearchResult, err error) Compare(dn string, attribute string, value string) (same bool, err error) - WhoAmI(controls []ldap.Control) (whoamiResult *ldap.WhoAmIResult, err error) + WhoAmI(controls []ldap.Control) (result *ldap.WhoAmIResult, err error) } // UserDetails represent the details retrieved for a given user.