Comments (5)
Can you please provide me with some example code that creates the error?
That error indicates that you performed a search that should have returned a unique LDAP entry, but either returned none or more than one.
I'll need to see your code to know if there's a problem with my code, your code, or your environment.
from go-ad-auth.
Hi
Here I am providing the username and password.
Code ---->
func Login(username, password, group string, config *Config) (bool, error) {
ok, _, err := LoginWithAttrs(username, password, group, config, nil)
return ok, err
}
/*
LoginWithAttrs will function exectly like Login, but will return a given
list of attributes for the user if login is successful.
*/
func LoginWithAttrs(username, password, group string, config *Config, attrs []string) (bool, map[string][]string, error) {
if password == "" {
return false, nil, nil
}
conn, err := config.Connect()
if err != nil {
return false, nil, err
}
defer conn.Close()
domain, err := getDomain(config.BaseDN)
if err != nil {
return false, nil, err
}
var upn string
if _, err = mail.ParseAddress(username); err == nil {
upn = username
} else {
upn = fmt.Sprintf("%s@%s", username, domain)
}
lErr := conn.Bind(upn, password)
if lErr != nil {
if config.Debug {
log.Printf("DEBUG: LDAP Error %v\n", lErr)
}
if e, ok := lErr.(*ldap.Error); ok {
if e.ResultCode == ldap.LDAPResultInvalidCredentials {
return false, nil, nil
}
}
return false, nil, lErr
}
if group != "" {
return inGroup(upn, group, config, conn, attrs)
}
entryAttrs, err := getAttrs(upn, config, conn, attrs)
fmt.Println(upn, " ", config, " ", conn, " ", attrs)
if err != nil {
return false, nil, err
}
return true, entryAttrs, nil
}
In fetching the entry attributes. This error occurs.
from go-ad-auth.
It looks like you're trying to use the v1 version of the library which is deprecated, not going to be updated, and not well tested.
Can you please try using the v2 version of the library? It's completely rewritten and fully tested. I think there's a good chance that whatever bug you've hit in v1 is likely fixed already in v2. If not, it will be much easier to find in v2.
It's not a drop-in replacement, but it's pretty easy swap everything over.
from go-ad-auth.
Closing due to no response. Feel free to reopen if you're still having this issue.
from go-ad-auth.
Hey this worked..thanks @korylprince .
from go-ad-auth.
Related Issues (13)
- Authenticates multiple passwords HOT 3
- Unable to change password with TLS not enabled in domain
- Unable to change user password if TLS is not enabled in domain HOT 3
- Escape LDAP filter arguments HOT 5
- adauth.AuthenticateExtended call is not returning an expected ldap group HOT 1
- Connection error: LDAP Result Code 2 "Protocol Error": unsupported extended operation HOT 3
- Wrong keyword HOT 1
- Authentication on LDAP over TLS does not work HOT 2
- Thanks for package HOT 1
- Get user groups HOT 6
- checking other users username and password HOT 2
- ObjectGroups HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-ad-auth.