Browse Source

fix lint issues

Signed-off-by: Ivan Zvyagintsev <ivan.zvyagintsev@flant.com>
pull/4640/head
Ivan Zvyagintsev 4 days ago
parent
commit
d5ff7e95ad
  1. 2
      connector/ldap/kerberos.go
  2. 3
      connector/ldap/kerberos_test.go
  3. 10
      server/handlers_test.go

2
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.

3
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 {

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

Loading…
Cancel
Save