Optional LDAP Authentication

Consider, I have a web app, with a page that contains a button. The button is only visible for user’s who are logged in.

All users irrespective of if they are logged in or not will use the same URL to access the page.

My Question is. How do I use the LDAP module and make it optional, so that users who are logged in see the button and those who are not don’t see the button?

I resolved the issue.
For anyone else who is struggling with this. You have to create a consumer, that you want to act as an “Anonymous” user or “a visitor”, if you like. Once created, make a note of the UUID of this new consumer and add it to the “config.anonymous” config option for your LDAP module.

After that it just works, even requests that are not authorised are passed through.

The upstream app can inspect the headers to see if the request is from an authorised user or an Anonymous user.

  • An authorised request will include the header “x-credential-username” //Note the lowercase
  • An anonymous request will include the header “X-Consumer-Username” //Note the Camel Case