'Runtime OAuth binding for LDAP server authentication

I am developing a Spring Boot REST API which needs to be able to authenticate users (I do not want to use Spring web apps, so there are no html pages in my project). The user credentials can be google, facebook, LDAP or database users. It is also a multi organisation app, so many organisations use it. Each organisation has its own google, facebook, LDAP servers. I can receive a parameter from the UI indicating which system to use for authentication. For example, I will receive organisation_id = 1, auth_method = LDAP. So I need to decide at runtime which OAuth servers to use and bind them when the server receives a request. I couldn't find any example like this. Is this possible using Spring Boot? I have seen many examples with using OAuth for google/facebook authentication. How can I use OAuth for LDAP at the same time, using Oauth libraries? Any example would be really appreciated. Do I have still have to use following dependency if I am using Oauth for LDAP?

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source