Skip to content

Puzzled about the boolean authenticate . #537

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

Closed
Koooooo-7 opened this issue Aug 3, 2019 · 1 comment
Closed

Puzzled about the boolean authenticate . #537

Koooooo-7 opened this issue Aug 3, 2019 · 1 comment
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Milestone

Comments

@Koooooo-7
Copy link

  • Springboot version: 2.0.3.RELEASE
  • Ldap version:
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-ldap</artifactId>
            <version>2.1.6.RELEASE</version>
        </dependency>

According to the reference document from https://docs.spring.io

Spring LDAP includes an authenticate method in LdapTemplate that provide this functionality: boolean authenticate(LdapQuery query, String password);
Using this method authentication becomes as simple as this:
Authenticating a user using Spring LDAP.

ldapTemplate.authenticate(query().where("uid").is("john.doe"), "secret");

the source code :

    /**
     * {@inheritDoc}
     */
    @Override
    public void authenticate(LdapQuery query, String password) {
        authenticate(query,
                password,
                new NullAuthenticatedLdapEntryContextCallback());
    }

and I tried to debug find the method

authenticate(query,password,newNullAuthenticatedLdapEntryContextCallback());

Authenticate success return the mapperCallback.collectedObject is null.

Puzzled :

  • the boolean authenticate method return is void .
  • it is a little bit weird when I use this authenticate method, the best result is nothing happen.
@jzheaux
Copy link
Collaborator

jzheaux commented Dec 14, 2021

@Koooooo-7 thanks for bringing this up. In the documentation section you refer to, there are two authenticate methods. The first is a proposed custom method and the second is the Spring-provided one. It's not meant for them to have the same signature.

I agree that this could be made clearer in the docs. My plan is to update the docs to show the Spring-provided method first and then talk about customizing.

@jzheaux jzheaux added this to the 2.4.0-M1 milestone Dec 14, 2021
@jzheaux jzheaux added in: docs An issue in Documentation or samples type: bug A general bug labels Dec 14, 2021
@jzheaux jzheaux modified the milestones: 2.4.0-M1, 2.4.0-M2 Jan 13, 2022
jzheaux added a commit that referenced this issue Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants