def get_oauth_provider_config(name):
    """
    Get 'other_settings' from the provider config.
    """
    # Importing module here to avoid circular reference
    from third_party_auth.models import OAuth2ProviderConfig
    provider_config = OAuth2ProviderConfig.current(name)
    settings = json.loads(provider_config.other_settings)
    return settings
    def setting(self, name, default=None):
        """Return setting value from strategy"""
        try:
            from third_party_auth.models import OAuth2ProviderConfig
        except ImportError:
            OAuth2ProviderConfig = None

        if OAuth2ProviderConfig is not None:
            provider_config = OAuth2ProviderConfig.current(self.name)
            if not provider_config.enabled:
                raise Exception("Can't fetch setting of a disabled backend.")
            try:
                return provider_config.get_setting(name)
            except KeyError:
                pass
        return super(NpoedBackend, self).setting(name, default=default)
    def setting(self, name, default=None):
        """Return setting value from strategy"""
        try:
            from third_party_auth.models import OAuth2ProviderConfig
        except ImportError:
            OAuth2ProviderConfig = None

        if OAuth2ProviderConfig is not None:
            provider_config = OAuth2ProviderConfig.current(self.name)
            if not provider_config.enabled:
                raise Exception("Can't fetch setting of a disabled backend.")
            try:
                return provider_config.get_setting(name)
            except KeyError:
                pass
        return super(WPOAuthBackend, self).setting(name, default=default)
Exemple #4
0
 def _id3_config(self):
     from third_party_auth.models import OAuth2ProviderConfig
     return OAuth2ProviderConfig.current(self.name)