Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with LDAP version >3.4.4 #130

Open
iliesh opened this issue Jun 21, 2024 · 1 comment
Open

Doesn't work with LDAP version >3.4.4 #130

iliesh opened this issue Jun 21, 2024 · 1 comment

Comments

@iliesh
Copy link

iliesh commented Jun 21, 2024

What version of Go are you using (go version)?

$ go version
go version go1.22.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What version of Go-Guardian are you using ?

Go-Guardian Version: 
github.com/shaj13/go-guardian/v2 v2.11.5

What did you do?

var strategy auth.Strategy
var cacheObj libcache.Cache

func InitLDAPConnection(cfg *config.Config) {
	ldapConfig := &ldap.Config{
		BaseDN:       cfg.LDAPBaseDN,
		BindDN:       "uid=" + cfg.LDAPBindUser + "," + cfg.LDAPBaseDN,
		Port:         cfg.LDAPPort,
		Host:         cfg.LDAPHost,
		BindPassword: cfg.LDAPBindPassord,
		Filter:       "(uid=%s)",
	}
	cacheObj = libcache.FIFO.New(0)
	cacheObj.SetTTL(time.Minute * 10)
	strategy = ldap.NewCached(ldapConfig, cacheObj)
}

What did you see instead?

# github.com/shaj13/go-guardian/v2/auth/strategies/ldap
/home/user/go/pkg/mod/github.com/shaj13/go-guardian/[email protected]/auth/strategies/ldap/ldap.go:71:9: cannot use ldap.DialURL(cfg.URL, opts...) (value of type *"github.com/go-ldap/ldap/v3".Conn) as conn value in return statement: *"github.com/go-ldap/ldap/v3".Conn does not implement conn (wrong type for method Close)
                have Close() (error)
                want Close()

Works ok with LDAP version 3.4.4:

github.com/go-ldap/ldap/v3 v3.4.4
@iliesh iliesh changed the title Doesn't work with Doesn't work with LDAP version >3.4.4 Jun 21, 2024
@sbildl
Copy link

sbildl commented Oct 7, 2024

After updating my go mod to use the latest versions (go get -u ./...), this error occurred for me, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants