Beispiel #1
0
    def parseSocialProviders(self):
        registeredProviders = {}

        try:
            passportDN = CdiUtil.bean(
                ConfigurationFactory).getLdapConfiguration().getString(
                    "oxpassport_ConfigurationEntryDN")
            entryManager = CdiUtil.bean(
                AppInitializer).createLdapEntryManager()
            config = LdapOxPassportConfiguration()
            config = entryManager.find(config.getClass(),
                                       passportDN).getPassportConfigurations()

            if config != None:
                for strategy in config:
                    provider = strategy.getStrategy()
                    registeredProviders[provider] = {"saml": False}

                    property = "logo_img"
                    for field in strategy.getFieldset():
                        if StringHelper.equalsIgnoreCase(
                                field.getValue1(), property):
                            registeredProviders[provider][
                                property] = field.getValue2()
                            break

                    if not property in registeredProviders[provider]:
                        registeredProviders[provider][
                            property] = "img/%s.png" % provider

        except:
            print "Casa. parseProviderConfigs. An error occurred while building the list of supported social authentication providers", sys.exc_info(
            )[1]

        return registeredProviders
Beispiel #2
0
    def parseProviderConfigs(self):

        self.registeredProviders = {}
        try:
            if self.behaveAs == None or self.behaveAs == "social":
                print "Passport. parseProviderConfigs. Adding social providers"
                passportDN = CdiUtil.bean(ConfigurationFactory).getLdapConfiguration().getString("oxpassport_ConfigurationEntryDN")
                entryManager = CdiUtil.bean(AppInitializer).getLdapEntryManager()
                config = LdapOxPassportConfiguration()
                config = entryManager.find(config.getClass(), passportDN).getPassportConfigurations()

                if config != None:
                    for strategy in config:
                        provider = strategy.getStrategy()
                        self.registeredProviders[provider] = { "emailLinkingSafe" : False }
                        for field in strategy.getFieldset():
                            if StringHelper.equalsIgnoreCase(field.getValue1(), "emailLinkingSafe") and StringHelper.equalsIgnoreCase(field.getValue2(), "true"):
                                self.registeredProviders[provider]["emailLinkingSafe"] = True

            if self.behaveAs == None or self.behaveAs == "saml":
                print "Passport. parseProviderConfigs. Adding SAML IDPs"
                f = open("/etc/gluu/conf/passport-saml-config.json", 'r')
                config = json.loads(f.read())

                for provider in config:
                    if "enable" in provider and StringHelper.equalsIgnoreCase(provider["enable"], "true"):
                        self.registeredProviders[provider] = {
                            "emailLinkingSafe" : "emailLinkingSafe" in provider and StringHelper.equalsIgnoreCase(provider["emailLinkingSafe"], "true"),
                            "saml" : True }

        except:
            print "Passport. parseProviderConfigs. An error occurred while building the list of supported authentication providers", sys.exc_info()[1]
Beispiel #3
0
    def parseProviderConfigs(self):

        self.registeredProviders = {}
        try:
            print "Passport. parseProviderConfigs. Adding social providers"
            passportDN = CdiUtil.bean(
                ConfigurationFactory).getLdapConfiguration().getString(
                    "oxpassport_ConfigurationEntryDN")
            entryManager = CdiUtil.bean(
                AppInitializer).createPersistenceEntryManager()
            config = LdapOxPassportConfiguration()
            config = entryManager.find(config.getClass(),
                                       passportDN).getPassportConfigurations()

            if config != None:
                for strategy in config:
                    idProvider = strategy.getStrategy()
                    provider = {
                        "emailLinkingSafe": False,
                        "requestForEmail": False
                    }

                    for field in strategy.getFieldset():
                        for property in provider:
                            if StringHelper.equalsIgnoreCase(
                                    field.getValue1(), property
                            ) and StringHelper.equalsIgnoreCase(
                                    field.getValue2(), "true"):
                                provider[property] = True

                        if (field.getValue1() == "logo_img"):
                            provider["logo_img"] = field.getValue2()

                    provider["saml"] = False
                    if not "logo_img" in provider:
                        provider["logo_img"] = "img/%s.png" % idProvider

                    self.registeredProviders[idProvider] = provider
        except:
            print "Passport. parseProviderConfigs. An error occurred while building the list of supported authentication providers", sys.exc_info(
            )[1]