Skip to content

In order to perform this operation a successful bind must be completed on the connection #142

Open

Description

@parthp2107

000004DC: LdapErr: DSID-0C090A5A, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4f7c

Activity

  1. dirmgr commented on Apr 4, 2023

    @dirmgr
    Collaborator

    There's not really any actual question here, but I assume that you're encountering this error and would like to know why.

    First, that error is coming from the directory server (Active Directory by the looks of it), and not from the LDAP SDK itself.

    Second, unlike many messages from Active Directory, this one is actually pretty clear. As the message states, the client needs to send a bind request to authenticate the connection before it will allow the operation you've requested.

  2. parthp2107 commented on Apr 4, 2023

    @parthp2107
    Author

    Can you please guide me on how I can perform a bind request to authenticate the connection?

  3. dirmgr commented on Apr 4, 2023

    @dirmgr
    Collaborator

    Use the LDAPConnection.bind method to submit an appropriate bind request. The easiest and most common type of bind is an LDAP simple bind, which authenticates with the DN and password for the user as whom you're trying to authenticate. If you don't have the DN and password for a user account, then you'll need to talk to a server administrator.

    Also, binds are one of the most fundamental concepts in LDAP. If you don't really understand them, then you should probably spend some time learning more about LDAP before proceeding.

  4. parthp2107 commented on Apr 4, 2023

    @parthp2107
    Author

    ldapConnectionPool.bind(storedUser.getName(), reqPassword);

    I am using this in my code. Is this what you are suggesting to use?
    I have the DN and the password.

  5. dirmgr commented on Apr 4, 2023

    @dirmgr
    Collaborator

    That call will perform a bind on a connection from the connection pool, but the problem is that if you subsequently try to perform another operation that requires a previous bind, if your connection pool has more than one connection, then there's no guarantee that it will choose the same connection for the bind as another operation that follows it.

    If you want to use the same credentials for all operations processed in the connection pool, then the best option would be to provide the credentials at the time you create the connection pool. The way that you do this depends on how you're creating the pool.

    • If you create a connection pool from an initial connection and tell it to just use more of those, then you should perform the bind on that connection before creating the pool.
    • If you create a connection pool from a server set, then you can also provide a bind request at that time.

    On the other hand, if you want most connections in the pool to either be unauthenticated, or authenticated as a different user, then you have a couple of options. But if the bind should just be considered temporary, then you'll probably need to check a connection out of the pool using the getConnection method, use that connection to perform the bind and the subsequent operations that need to be authenticated as that user, then return the connection back to the pool using the releaseAndReAuthenticateConnection method. The releaseAndReAuthenticateConnection method will attempt to revert the connection back to the authentication state it had when the connection was initially established by the pool (and if it was initially unauthenticated, then the pool will use an anonymous simple bind to try to achieve that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions