@Override public HttpServerAuthenticationMechanism createAuthenticationMechanism( String mechanismName, Map<String, ?> properties, CallbackHandler callbackHandler) { for (Provider current : providers.get()) { Set<Service> services = current.getServices(); if (services != null) { for (Service currentService : services) { if (SERVICE_TYPE.equals(currentService.getType())) { try { HttpServerAuthenticationMechanismFactory factory = (HttpServerAuthenticationMechanismFactory) currentService.newInstance(null); HttpServerAuthenticationMechanism mechanism = factory.createAuthenticationMechanism(mechanismName, properties, callbackHandler); if (mechanism != null) { return mechanism; } } catch (NoSuchAlgorithmException e) { log.debug(e); } } } } } return null; }
@Override public String[] getMechanismNames(Map<String, ?> properties) { Set<String> mechanismNames = new LinkedHashSet<>(); for (Provider current : providers.get()) { Set<Service> services = current.getServices(); if (services != null) { for (Service currentService : services) { if (SERVICE_TYPE.equals(currentService.getType())) { try { String[] serviceMechNames = ((HttpServerAuthenticationMechanismFactory) currentService.newInstance(null)) .getMechanismNames(properties); Collections.addAll(mechanismNames, serviceMechNames); } catch (NoSuchAlgorithmException e) { log.debug(e); } } } } } return mechanismNames.toArray(new String[mechanismNames.size()]); }