Iterator<AuthenticationDomain> serviceIterator =
utilsService.getServiceIterator(providers, AuthenticationDomain.class);
AuthenticationException lastException = null;
LOGGER.debug("iterating {} authenticationProviderServices", providers.size());
while (serviceIterator.hasNext()) {
AuthenticationDomain provider = serviceIterator.next();
if (provider.supports(credentials)) {
LOGGER.info("attempting authentication using provider {}", provider.getClass());
try {
return provider.authenticate(username, credentials);
} catch (AuthenticationException e) {
lastException = e;
}
}
}