def __init__(self, user, password, projectid, auth_url, insecure=False, timeout=None, tenant_id=None, proxy_tenant_id=None, proxy_token=None, region_name=None, endpoint_type='publicURL', service_type=None, service_name=None, database_service_name=None, retries=None, http_log_debug=False, cacert=None, bypass_url=None, auth_system='keystone', auth_plugin=None): if auth_system and auth_system != 'keystone' and not auth_plugin: raise exceptions.AuthSystemNotFound(auth_system) if not auth_url and auth_system and auth_system != 'keystone': auth_url = auth_plugin.get_auth_url() if not auth_url: raise exceptions.EndpointNotFound() self.user = user self.password = password self.projectid = projectid self.tenant_id = tenant_id self.auth_url = auth_url.rstrip('/') if auth_url else auth_url self.version = 'v1' self.region_name = region_name self.endpoint_type = endpoint_type self.service_type = service_type self.service_name = service_name self.database_service_name = database_service_name self.retries = int(retries or 0) self.http_log_debug = http_log_debug self.management_url = None self.auth_token = None self.proxy_token = proxy_token self.proxy_tenant_id = proxy_tenant_id self.timeout = timeout self.bypass_url = bypass_url self.auth_system = auth_system self.auth_plugin = auth_plugin if insecure: self.verify_cert = False else: if cacert: self.verify_cert = cacert else: self.verify_cert = True self.auth_system = auth_system self.auth_plugin = auth_plugin self.LOG = logging.getLogger(__name__) if self.http_log_debug and not self.LOG.handlers: ch = logging.StreamHandler() self.LOG.setLevel(logging.DEBUG) self.LOG.addHandler(ch) if hasattr(requests, 'logging'): requests.logging.getLogger(requests.__name__).addHandler(ch)
def load_plugin(auth_system): if auth_system in _discovered_plugins: return _discovered_plugins[auth_system]() raise exceptions.AuthSystemNotFound(auth_system)
def authenticate(self, cls, auth_url): """Authenticate using plugin defined method.""" raise exceptions.AuthSystemNotFound(self.auth_system)