Exemplo n.º 1
0
    def authenticate(self):
        """
        Launch the authentication process: for 'auto' provider, it means first to find the relevant
        provider, then call its authenticate() method. Almost every subsequent operation will then 
        be delegated to that provider.
        """
        mapping_override = self.options.get('mapping_override')
        mapping_override_processed = {}
        if mapping_override:
            for one_mapping in mapping_override.split(','):
                one_mapping_processed = one_mapping.split(':')
                mapping_override_processed[
                    one_mapping_processed[0]] = one_mapping_processed[1]

        override_provider = mapping_override_processed.get(self.domain)
        if override_provider:
            provider = [
                element for element in AVAILABLE_PROVIDERS
                if element.__name__ == override_provider
            ][0]
            logger.info('Provider authoritatively mapped for domain %s: %s.',
                        self.domain, provider.__name__)
        else:
            (provider_name,
             provider_module) = _relevant_provider_for_domain(self.domain)
            logger.info('Provider discovered for domain %s: %s.', self.domain,
                        provider_name)

        new_options = env_auth_options(provider_name)
        for key, value in self.options.items():
            target_prefix = 'auto_{0}_'.format(provider_name)
            if key.startswith(target_prefix):
                new_options[re.sub('^{0}'.format(target_prefix), '',
                                   key)] = value
            if not key.startswith('auto_'):
                new_options[key] = value

        new_options['provider_name'] = provider_name

        self.proxy_provider = provider_module.Provider(new_options,
                                                       self.engine_overrides)
        self.proxy_provider.authenticate()
Exemplo n.º 2
0
 def _test_options(self):
     cmd_options = SafeOptions()
     cmd_options['domain'] = self.domain
     cmd_options.update(env_auth_options(self.provider_name))
     return cmd_options
Exemplo n.º 3
0
 def _test_options(self):
     options = super(NamecheapProviderTests, self)._test_options()
     options.update({'auth_sandbox':True})
     options.update({'auth_client_ip':'127.0.0.1'})
     options.update(env_auth_options(self.provider_name))
     return options
Exemplo n.º 4
0
 def _test_options(self):
     cmd_options = SafeOptions()
     cmd_options['domain'] = self.domain
     cmd_options.update(env_auth_options(self.provider_name))
     return cmd_options
Exemplo n.º 5
0
 def _test_options(self):
     cmd_options = super(CloudnsProviderTests, self)._test_options()
     cmd_options.update(env_auth_options(self.provider_name))
     return cmd_options
Exemplo n.º 6
0
 def _test_options(self):
     options = super(NamecheapProviderTests, self)._test_options()
     options.update({'auth_sandbox':True})
     options.update({'auth_client_ip':'127.0.0.1'})
     options.update(env_auth_options(self.provider_name))
     return options