41 String clientId = deployment.getResourceName();
42 Map<String, Object> clientCredentials = deployment.getResourceCredentials();
44 String authenticatorId;
45 if (clientCredentials == null || clientCredentials.isEmpty()) {
46 authenticatorId = ClientIdAndSecretCredentialsProvider.PROVIDER_ID;
48 authenticatorId = (String) clientCredentials.get(
"provider");
49 if (authenticatorId == null) {
51 if (clientCredentials.size() == 1) {
52 authenticatorId = clientCredentials.keySet().iterator().next();
54 throw new RuntimeException(
"Can't identify clientAuthenticator from the configuration of client '" + clientId +
"' . Check your adapter configurations");
59 logger.debugf(
"Using provider '%s' for authentication of client '%s'", authenticatorId, clientId);
61 Map<String, ClientCredentialsProvider> authenticators =
new HashMap<>();
62 loadAuthenticators(authenticators, ClientCredentialsProviderUtils.class.getClassLoader());
65 ClientCredentialsProvider authenticator = authenticators.get(authenticatorId);
66 if (authenticator == null) {
67 throw new RuntimeException(
"Couldn't find ClientCredentialsProvider implementation class with id: " + authenticatorId +
". Loaded authentication providers: " + authenticators.keySet());
70 Object config = (clientCredentials==null) ? null : clientCredentials.get(authenticatorId);
71 authenticator.init(deployment, config);
static void loadAuthenticators(Map< String, ClientCredentialsProvider > authenticators, ClassLoader classLoader)
Definition: ClientCredentialsProviderUtils.java:76
static Logger logger
Definition: ClientCredentialsProviderUtils.java:38