def parseProviderConfigs(self): print "Casa. parseProviderConfigs. Adding external providers" registeredProviders = {} preSelParams = self.getPreselectionIDPParams() try: passportDN = CdiUtil.bean(ConfigurationFactory).getPersistenceConfiguration().getConfiguration().getString("oxpassport_ConfigurationEntryDN") entryManager = CdiUtil.bean(AppInitializer).createPersistenceEntryManager() config = LdapOxPassportConfiguration() config = entryManager.find(config.getClass(), passportDN).getPassportConfiguration() config = config.getProviders() if config != None else config if config != None and len(config) > 0: for prvdetails in config: if prvdetails.isEnabled(): isSaml = prvdetails.getType() == "saml" if (preSelParams["saml"] != None and isSaml) or (preSelParams["social"] != None and not isSaml): registeredProviders[prvdetails.getId()] = { "logo_img": prvdetails.getLogoImg() "displayName": prvdetails.getDisplayName(), "saml": isSaml } except: print "Casa. parseProviderConfigs. An error occurred while building the list of supported authentication providers", sys.exc_info()[1] print "Casa. parseProviderConfigs. Resulting list %s" % registeredProviders self.preSelParams = preSelParams return registeredProviders
def parseAllProviders(self): registeredProviders = {} print "Passport. parseAllProviders. Adding providers" passportDN = CdiUtil.bean( ConfigurationFactory).getPersistenceConfiguration( ).getConfiguration().getString("oxpassport_ConfigurationEntryDN") entryManager = CdiUtil.bean( AppInitializer).createPersistenceEntryManager() config = LdapOxPassportConfiguration() config = entryManager.find(config.getClass(), passportDN).getPassportConfiguration() config = config.getProviders() if config != None else config if config != None and len(config) > 0: for prvdetails in config: if prvdetails.isEnabled(): registeredProviders[prvdetails.getId()] = { "emailLinkingSafe": prvdetails.isEmailLinkingSafe(), "requestForEmail": prvdetails.isRequestForEmail(), "logo_img": prvdetails.getLogoImg(), "displayName": prvdetails.getDisplayName(), "type": prvdetails.getType() } return registeredProviders
def parseProviders(self): print("Passport. parseProviders. Adding providers") registeredProviders = {} entryManager = CdiUtil.bean(PersistenceEntryManager) config = LdapOxPassportConfiguration() passportDN = self.getPassportConfigDN() passportConfig = entryManager.find( config.getClass(), passportDN).getPassportConfiguration() if passportConfig is None: print( "Passport. parseProviders. Failed to retrieve the passport configuration" ) return None providers = passportConfig.getProviders() if providers is not None and len(providers) > 0: for provider in providers: if provider.isEnabled(): registeredProviders[provider.getId()] = { "type": provider.getType(), "options": provider.getOptions(), "GCCF": "GCCF" in provider.getOptions() and provider.getOptions()["GCCF"].lower() in ["true", "yes"], "callbackUrl": provider.getCallbackUrl() } print("Configured %s provider %s" % (provider.getType(), provider.getId())) return registeredProviders
def parseAllProviders(self): registeredProviders = {} print "Passport-social. parseAllProviders. Adding providers" entryManager = CdiUtil.bean(PersistenceEntryManager) config = LdapOxPassportConfiguration() config = entryManager.find(config.getClass(), self.passportDN).getPassportConfiguration() config = config.getProviders() if config != None else config if config != None and len(config) > 0: for prvdetails in config: if prvdetails.isEnabled(): registeredProviders[prvdetails.getId()] = { "emailLinkingSafe": prvdetails.isEmailLinkingSafe(), "requestForEmail" : prvdetails.isRequestForEmail(), "logo_img": prvdetails.getLogoImg(), "displayName": prvdetails.getDisplayName(), "type": prvdetails.getType(), "issuer": prvdetails.getOptions().get("issuer") } return registeredProviders