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

LDAP health check does not use custom configuration #26704

Closed
semangard opened this issue May 29, 2021 · 6 comments
Closed

LDAP health check does not use custom configuration #26704

semangard opened this issue May 29, 2021 · 6 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@semangard
Copy link

I am running a maven clean package:

image

  1. The development profile has LDAP health-check deactivated:
    image

Nevertheless I have the following error:
image

  1. I have even coded a custom LDAP configuration BUT it doesn't seem to be taken into account by the LDAP health-check ( whereas my real code works fine and doesn't face the same LDAP issue when making LDAP requests at runtime)
    image

Regards

@snicoll snicoll added the status: invalid An issue that we don't feel is valid label May 29, 2021
@semangard semangard reopened this May 29, 2021
@semangard
Copy link
Author

Sorry I still have the issue.

@snicoll
Copy link
Member

snicoll commented May 31, 2021

Sorry but we can't really figure out what is going on based on screenshots. The configuration key you highlight is correct but that doesn't mean that Spring Boot read it. If you want support, please take the time to create a small sample that we can run ourselves. You can share it with us as a zip attached to this issue or by providing a link to a GitHub repo.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged and removed status: invalid An issue that we don't feel is valid labels May 31, 2021
@snicoll snicoll changed the title Spring Boot Actuator : Exception during LDAP health check despite the profile was saying not to check it and despite a custom LDAP configuration is coded LDAP health check does not use custom configuration May 31, 2021
@onobc
Copy link
Contributor

onobc commented Jun 2, 2021

@semangard

If you want some tips on how to debug it yourself, here is what I would do...

  1. Verify that the properties in application-development.yml are in fact being used. There is a good chance they are not since the health indicator has a property based guard on management.health.ldap.enabled. Just put a debugger on the app and set a breakpoint and inspect the environment.

    @Autowired 
    private Environment env;
    
    @PostConstruct
    void init() {
      System.out.println("**** Hi - put a breakpoint here and scan through env a bit");
    }
  2. Verify that the user-configured ContextSource (the one in your screenshot) is/not being used by the auto-config when it creates the LdapTemplate:

    • Set a breakpoint in your user-configured ContextSource bean definition method
    • Set a breakpoint on the auto-configured LdapContextSource
    • Set a breakpoint on the auto-configured LdapTemplate.java#71

    By stepping through the app startup you should be able to answer the following:

    • Is your user-configured ContextSource being created? Is it being used in the LdapTemplate?
    • Is the auto-configured LdapContextSource being created? Is it being used in the LdapTemplate?
    • Notice that your bean is of type ContextSource and the auto-configured one is LdapContextSource. What happens if you change your signature to LdapContextSource?

Almost all of the details I have learned about the framework is by attaching a debugger. That is what demystifies the magic. :)

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 2, 2021
@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jun 2, 2021
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Jun 9, 2021
@semangard
Copy link
Author

Thanks, I got in fact an issue with the spring profile used by maven during tests.
It is solved : management.health.ldap.enabled=false is correctly taken into account now.

@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jun 9, 2021
@snicoll
Copy link
Member

snicoll commented Jun 9, 2021

Thanks for following up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants