diff --git a/connector/ldap/kerberos.go b/connector/ldap/kerberos.go index 7030bfb6..de0b1c25 100644 --- a/connector/ldap/kerberos.go +++ b/connector/ldap/kerberos.go @@ -12,6 +12,7 @@ import ( "os" "strings" + "github.com/go-ldap/ldap/v3" "github.com/jcmturner/gofork/encoding/asn1" "github.com/jcmturner/gokrb5/v8/credentials" "github.com/jcmturner/gokrb5/v8/gssapi" @@ -21,7 +22,6 @@ import ( "github.com/jcmturner/gokrb5/v8/types" "github.com/dexidp/dex/connector" - "github.com/go-ldap/ldap/v3" ) // KerberosValidator abstracts SPNEGO validation for unit-testing. diff --git a/connector/ldap/kerberos_test.go b/connector/ldap/kerberos_test.go index 3885e40b..930794d5 100644 --- a/connector/ldap/kerberos_test.go +++ b/connector/ldap/kerberos_test.go @@ -8,8 +8,9 @@ import ( "strings" "testing" - "github.com/dexidp/dex/connector" ldaplib "github.com/go-ldap/ldap/v3" + + "github.com/dexidp/dex/connector" ) type mockKrbValidator struct { diff --git a/server/handlers_test.go b/server/handlers_test.go index d89c5aa6..851313ab 100644 --- a/server/handlers_test.go +++ b/server/handlers_test.go @@ -1031,11 +1031,14 @@ func TestHandlePasswordLogin_SPNEGOShortCircuit(t *testing.T) { // to simulate successful SPNEGO authentication on GET. type spnegoShortCircuit struct{ Identity connector.Identity } -func (s spnegoShortCircuit) Close() error { return nil } +func (s spnegoShortCircuit) Close() error { return nil } + func (s spnegoShortCircuit) Prompt() string { return "" } + func (s spnegoShortCircuit) Login(ctx context.Context, sc connector.Scopes, u, p string) (connector.Identity, bool, error) { return connector.Identity{}, false, nil } + func (s spnegoShortCircuit) TrySPNEGO(ctx context.Context, sc connector.Scopes, w http.ResponseWriter, r *http.Request) (*connector.Identity, connector.Handled, error) { id := s.Identity return &id, true, nil @@ -1045,11 +1048,14 @@ func (s spnegoShortCircuit) TrySPNEGO(ctx context.Context, sc connector.Scopes, // to simulate SPNEGO authentication that fails with an error (e.g., LDAP lookup failed). type spnegoError struct{ Err error } -func (s spnegoError) Close() error { return nil } +func (s spnegoError) Close() error { return nil } + func (s spnegoError) Prompt() string { return "" } + func (s spnegoError) Login(ctx context.Context, sc connector.Scopes, u, p string) (connector.Identity, bool, error) { return connector.Identity{}, false, nil } + func (s spnegoError) TrySPNEGO(ctx context.Context, sc connector.Scopes, w http.ResponseWriter, r *http.Request) (*connector.Identity, connector.Handled, error) { return nil, true, s.Err }