Merge pull request #1609 from mposolda/master
KEYCLOAK-1824 ClientIdAndSecretCredentialsProvider not found when dep…
This commit is contained in:
commit
1c38bb7158
1 changed files with 13 additions and 2 deletions
|
@ -1,8 +1,10 @@
|
||||||
package org.keycloak.adapters.authentication;
|
package org.keycloak.adapters.authentication;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.ServiceConfigurationError;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
|
@ -55,8 +57,17 @@ public class ClientCredentialsProviderUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadAuthenticators(Map<String, ClientCredentialsProvider> authenticators, ClassLoader classLoader) {
|
private static void loadAuthenticators(Map<String, ClientCredentialsProvider> authenticators, ClassLoader classLoader) {
|
||||||
for (ClientCredentialsProvider authenticator : ServiceLoader.load(ClientCredentialsProvider.class, classLoader)) {
|
Iterator<ClientCredentialsProvider> iterator = ServiceLoader.load(ClientCredentialsProvider.class, classLoader).iterator();
|
||||||
authenticators.put(authenticator.getId(), authenticator);
|
while (iterator.hasNext()) {
|
||||||
|
try {
|
||||||
|
ClientCredentialsProvider authenticator = iterator.next();
|
||||||
|
logger.debugf("Loaded clientCredentialsProvider %s", authenticator.getId());
|
||||||
|
authenticators.put(authenticator.getId(), authenticator);
|
||||||
|
} catch (ServiceConfigurationError e) {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("Failed to load clientCredentialsProvider with classloader: " + classLoader, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue