GithubHelp home page GithubHelp logo

Comments (9)

jsumners avatar jsumners commented on July 2, 2024 1

I'm sorry, but I cannot tell you anything about the configuration of your LDAP server. I am closing this because we have covered all of the issues that pertain to usage of the ldapjs library.

from node-ldapjs.

jsumners avatar jsumners commented on July 2, 2024

I think this is a duplicate of #865. Please use English for issue reports.

from node-ldapjs.

RayllanSouza avatar RayllanSouza commented on July 2, 2024

OK sorry. Even after performing the "duplicate" procedures I still get the error. I don't know where the error is

from node-ldapjs.

jsumners avatar jsumners commented on July 2, 2024

I do not understand what you mean by "the duplicate procedures". What changes did you make to the code sample you provided that still result in the error?

from node-ldapjs.

RayllanSouza avatar RayllanSouza commented on July 2, 2024

Sorry for the "duplicate procedures", it's just that I don't communicate very well using English, I made the change incorrectly, but now after making the change I get a new error.
He follows:

C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\@ldapjs\dn\lib\utils\parse-string\read-attribute-value.js:34
    throw Error('attribute value does not start with equals sign')
    ^

Error: attribute value does not start with equals sign
    at readAttributeValue (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\@ldapjs\dn\lib\utils\parse-string\read-attribute-value.js:34:11)
    at readAttributePair (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\@ldapjs\dn\lib\utils\parse-string\read-attribute-pair.js:62:27)
    at parseString (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\@ldapjs\dn\lib\utils\parse-string\index.js:66:32)
    at DN.fromString (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\@ldapjs\dn\lib\dn.js:331:18)
    at ensureDN (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\ldapjs\lib\client\client.js:85:15)
    at Client.modify (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\ldapjs\lib\client\client.js:473:13)
    at C:\Users\rayllan.souza\Desktop\ldapjs\index.js:30:21
    at Client.callbackWrapper (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\ldapjs\lib\client\client.js:296:5)
    at Client.emit (node:events:511:28)
    at Socket.onResult (C:\Users\rayllan.souza\Desktop\ldapjs\node_modules\ldapjs\lib\client\client.js:812:14)

Code:

    return new Promise((resolve, reject) => {
 
     try {
      ldapClient.bind("usuarioADM", "senhaADM", err => {
         if (err) {
           reject(err);
         }
 
         ldapClient.modify(user, [
           new ldap.Change({
             operation: 'replace',
             modification: {
              type: "unicodePwd",
              values: [encodePassword(newpassword)]
             }
           })
         ], (error) => {
           if (error) {
             reject(error);
           } else {
             resolve('Successfully password modified.');
           }
         });
       })
      }catch (error) {
       console.error(error);
       reject(error);
 
      }
    })

from node-ldapjs.

jsumners avatar jsumners commented on July 2, 2024

What is encodePassword? Does it return a string? What is the value of user? Is it a DN string pointing to the entity to be changed?

Please see

tap.test('modify array success', function (t) {
const changes = [
new Change({
operation: 'Replace',
modification: new Attribute({
type: 'cn',
values: ['test']
})
}),
new Change({
operation: 'Delete',
modification: new Attribute({
type: 'sn'
})
})
]
t.context.client.modify('cn=modify, ' + SUFFIX, changes, function (err, res) {
t.error(err)
t.ok(res)
t.equal(res.status, 0)
t.end()
})
})

from node-ldapjs.

RayllanSouza avatar RayllanSouza commented on July 2, 2024

What is encodePassword?
R: Yes, return string;
What is the value of user?
R: Yes, return cn=user

After checking the code you sent I was able to review some things I was doing wrong, but now I get the error "Invalid Credentials" on the bind method even with the correct username and password

from node-ldapjs.

jsumners avatar jsumners commented on July 2, 2024

Your example shows a simple username and password combination. Standard LDAP servers require the "username" be a DN string pointing to the user entity in the directory.

from node-ldapjs.

RayllanSouza avatar RayllanSouza commented on July 2, 2024

Ok, I added the correct line and the error is gone. Operations error only occurs now, can you tell me if it can be user permission in the domain? I'm trying to create a tool that resets the password of a third-party user, this user who has the name "reset" was given permission to change the password of other users only, he does not have administrator permissions.

from node-ldapjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.