def __init__(self, app, conf): self.app = app self.conf = conf self.logger = get_logger(conf, log_route='liteauth') self.provider = load_oauth_provider( conf.get('oauth_provider', 'google_oauth')) self.auth_endpoint = conf.get('auth_endpoint', '') if not self.auth_endpoint: raise ValueError('auth_endpoint not set in config file') if isinstance(self.auth_endpoint, unicode): self.auth_endpoint = self.auth_endpoint.encode('utf-8') parsed_path = urlparse(self.auth_endpoint) if not parsed_path.netloc: raise ValueError('auth_endpoint is invalid in config file') self.auth_domain = parsed_path.netloc self.login_path = parsed_path.path self.scheme = parsed_path.scheme if self.scheme != 'https': raise ValueError('auth_endpoint must have https:// scheme') # by default service_domain can be extracted from the endpoint # in case where auth domain is different from service domain # you need to set up the service domain separately # Example: # auth_endpoint = https://auth.example.com/login # service_domain = https://www.example.com self.service_domain = conf.get('service_domain', '%s://%s' % (self.scheme, self.auth_domain)) self.storage_driver = None self.oauth_login_timeout = 3600
def __init__(self, app, conf): self.app = app self.conf = conf self.version = 'v1' self.auth_endpoint = conf.get('auth_endpoint', '') if not self.auth_endpoint: raise ValueError('auth_endpoint not set in config file') if isinstance(self.auth_endpoint, unicode): self.auth_endpoint = self.auth_endpoint.encode('utf-8') parsed_path = urlparse(self.auth_endpoint) if not parsed_path.netloc: raise ValueError('auth_endpoint is invalid in config file') self.auth_domain = parsed_path.netloc self.login_path = parsed_path.path self.scheme = parsed_path.scheme if self.scheme != 'https': raise ValueError('auth_endpoint must have https:// scheme') # by default service_domain can be extracted from the endpoint # in case where auth domain is different from service domain # you need to set up the service domain separately # Example: # auth_endpoint = https://auth.example.com/login # service_domain = https://www.example.com self.service_domain = conf.get('service_domain', '%s://%s' % (self.scheme, self.auth_domain)) self.logger = get_logger(conf, log_route='lite-auth') # try to refresh token # when less than this amount of seconds left self.refresh_before = conf.get('token_refresh_before', 60 * 29) # url for whitelist objects # Example: /v1/liteauth/whitelist self.whitelist_url = conf.get('whitelist_url', '').lower().rstrip('/') # url for invite objects # Example: /v1/liteauth/invites self.invite_url = conf.get('invite_url', '').lower().rstrip('/') self.storage_driver = None self.metadata_key = conf.get('metadata_key', 'userdata').lower() self.provider = load_oauth_provider(conf.get('oauth_provider', 'google_oauth')) self.oauth_login_timeout = 3600
def __init__(self, app, conf): self.app = app self.conf = conf self.version = 'v1' self.service_domain = conf.get('service_domain') if not self.service_domain: raise ValueError('service_domain not set in config file') self.service_endpoint = conf.get('service_endpoint', 'https://' + self.service_domain) self.auth_path = '/login/google/' self.logger = get_logger(conf, log_route='lite-auth') self.log_headers = conf.get('log_headers', 'false').lower() \ in TRUE_VALUES # try to refresh token # when less than this amount of seconds left self.refresh_before = conf.get('token_refresh_before', 60 * 29) # url for whitelist objects # Example: /v1/liteauth/whitelist self.whitelist_url = conf.get('whitelist_url', '').lower().rstrip('/') self.storage_driver = None self.metadata_key = conf.get('metadata_key', 'userdata').lower() self.redirect_url = '%s%s' % (self.service_endpoint, self.auth_path) self.provider = load_oauth_provider(conf.get('oauth_provider', 'google_oauth'))