/** * Get a SSO Provider from the ServiceLoader * * @param id SSO Implementation ID * @return SSOInterface implementation matching the ID, if found */ private SSOInterface getSSOProvider(String id) { ServiceLoader<SSOInterface> providers = ServiceLoader.load(SSOInterface.class); for (SSOInterface provider : providers) { if (id.equals(provider.getId())) { return provider; } } return null; }
/** * Build a Map of Maps of on-screen string values for each SSO provider. Should be enough to * generate a login interface. * * @return Map Containing the data structure of valid SSO interfaces. */ @Override public Map<String, Map<String, String>> ssoBuildLogonInterface(JsonSessionState session) { Map<String, Map<String, String>> ssoInterface = new LinkedHashMap<String, Map<String, String>>(); for (String ssoId : sso.keySet()) { SSOInterface provider = sso.get(ssoId); Map<String, String> map = new HashMap<String, String>(); map.put("label", provider.getLabel()); map.put("interface", provider.getInterface(ssoLoginUrl + "?ssoId=" + ssoId)); ssoInterface.put(ssoId, map); } return ssoInterface; }