Check the user has configured API live/test keys correctly.
335180
def check_stripe_api_key(app_configs=None, **kwargs):
	""""""
	from . import settings as djstripe_settings

	messages = []

	if not djstripe_settings.STRIPE_SECRET_KEY:
		msg = "Could not find a Stripe API key."
		hint = "Add STRIPE_TEST_SECRET_KEY and STRIPE_LIVE_SECRET_KEY to your settings."
		messages.append(checks.Critical(msg, hint=hint, id="djstripe.C001"))
	elif djstripe_settings.STRIPE_LIVE_MODE:
		if not djstripe_settings.LIVE_API_KEY.startswith(("sk_live_", "rk_live_")):
			msg = "Bad Stripe live API key."
			hint = 'STRIPE_LIVE_SECRET_KEY should start with "sk_live_"'
			messages.append(checks.Critical(msg, hint=hint, id="djstripe.C002"))
	else:
		if not djstripe_settings.TEST_API_KEY.startswith(("sk_test_", "rk_test_")):
			msg = "Bad Stripe test API key."
			hint = 'STRIPE_TEST_SECRET_KEY should start with "sk_test_"'
			messages.append(checks.Critical(msg, hint=hint, id="djstripe.C003"))

	return messages
797543
def check_key(key, allowed):
    

    if key in allowed:
        return True

    for pattern in allowed:
        if fnmatch(key, pattern):
            return True

    return False
1105653
def _is_api_key_correct(request):
    """"""
    api_key = getattr(settings, 'GECKOBOARD_API_KEY', None)
    if api_key is None:
        return True
    auth = request.META.get('HTTP_AUTHORIZATION', '').split()
    if len(auth) == 2:
        if auth[0].lower() == b'basic':
            request_key = base64.b64decode(auth[1]).split(b':')[0]
            return request_key == api_key
    return False
349680
def _validate(self):
        
        for key in self:
            if key not in DEFAULTS:
                raise exceptions.ConfigurationException(
                    'Unknown configuration key "{}"! Valid configuration keys are'
                    " {}".format(key, list(DEFAULTS.keys()))
                )

        validate_queues(self["queues"])
        validate_bindings(self["bindings"])
        validate_client_properties(self["client_properties"])
1088270
function verifyConfiguration (req, sessionKey, cookie) {
  if (!getSecretBag(req, sessionKey, cookie)) {
    return false
  }

  if (cookie && cookie.signed && !req.secret) {
    return false
  }

  return true
}
156814
def check_credentials(self):
        '''  '''
        req = requests.get(self.api_server + '/api/ad',
                           auth=(self.access_key, self.secret_key))
        # Not sure 500 server error should be included here
        if req.status_code in [401, 403, 500]:
            return False
        else:
            return True
178217
def authenticate_key(api_key):
    
    user_model = Query()
    user = db.search(user_model.api_key == api_key)[0]
    if user:
        return user['username']
    return False
1254864
def _preflight_check(desired, fromrepo, **kwargs):
    '''
    
    '''
    if 'pkg.check_db' not in __salt__:
        return {}
    ret = {'suggest': {}, 'no_suggest': []}
    pkginfo = __salt__['pkg.check_db'](
        *list(desired.keys()), fromrepo=fromrepo, **kwargs
    )
    for pkgname in pkginfo:
        if pkginfo[pkgname]['found'] is False:
            if pkginfo[pkgname]['suggestions']:
                ret['suggest'][pkgname] = pkginfo[pkgname]['suggestions']
            else:
                ret['no_suggest'].append(pkgname)
    return ret
28758
def check_config(db, level):
    """"""
    if level == 'global':
        configuration = config.read(config.HOMEDIR, '.passpierc')
    elif level == 'local':
        configuration = config.read(os.path.join(db.path))
    elif level == 'current':
        configuration = db.config

    if configuration:
        click.echo(yaml.safe_dump(configuration, default_flow_style=False))
732798
def checkppolicy(self, **params):
        
        self._check_auth(must_admin=False, redir_login=False)
        keys = list(params.keys())
        if len(keys) != 1:
            cherrypy.response.status = 400
            return "bad argument"
        password = params[keys[0]]
        is_admin = self._check_admin()
        ret = self._checkppolicy(password)
        if ret['match']:
            cherrypy.response.status = 200
        else:
            cherrypy.response.status = 200
        return json.dumps(ret, separators=(',', ':'))
1353771
def check_auth_params
      if (Fulfil.authentication.nil? || Fulfil.authentication[:subdomain].empty? || Fulfil.authentication[:api_key].empty?)
        raise Fulfil::AuthenticationError, "Please set your subdomain and api key"
      end
    end
1294462
def enable_service_freshness_checks(self):
        
        if not self.my_conf.check_service_freshness:
            self.my_conf.modified_attributes |= \
                DICT_MODATTR["MODATTR_FRESHNESS_CHECKS_ENABLED"].value
            self.my_conf.check_service_freshness = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
39075
def verify_authentication_data(self, key):
        '''
        
        '''
        correct_authentication_data = self.calculate_authentication_data(key)
        return self.authentication_data == correct_authentication_data
433826
def _check_user_parameters(self, user_parameters):
        
        if not user_parameters:
            return

        # sanity check against typos
        for key in user_parameters:
            if key not in submission_defaults:
                raise ValueError("Unknown parameter {0}".format(key))
1049135
def check(cls):
        
        attribs = [
            'app_version',
            'app_name',
            'config_file_path',
            'config_sep_str',
        ]
        for attrib in attribs:
            if getattr(cls, attrib) == 'not_set':
                raise IncompleteSetupError(f'elib_config setup is incomplete; missing: {attrib}')
38041
def verify_keys(self):
        """"""
        verify_keys_endpoint = Template("${rest_root}/site/${public_key}")
        url = verify_keys_endpoint.substitute(rest_root=self._rest_root, public_key=self._public_key)
        
        data = { "clientName": "mollom_python", "clientVersion": "1.0" }

        self._client.headers["Content-Type"] = "application/x-www-form-urlencoded"

        response = self._client.post(url, data, timeout=self._timeout)
        if response.status_code != 200:
            raise MollomAuthenticationError

        return True
939384
def check_configuration(ctx, base_key, needed_keys):
    

    # check for valid configuration
    if base_key not in ctx.keys():
        exit("[{}ERROR{}] missing configuration for '{}'"
             .format(ERROR_COLOR, RESET_COLOR, base_key))
        # TODO: offer to create configuration file
    if ctx.releaser is None:
        exit("[{}ERROR{}] empty configuration for '{}' found"
             .format(ERROR_COLOR, RESET_COLOR, base_key))
        # TODO: offer to create configuration file

    # TODO: allow use of default values
    for my_key in needed_keys:
        if my_key not in ctx[base_key].keys():
            exit("[{}ERROR{}] missing configuration key '{}.{}'"
                 .format(ERROR_COLOR, RESET_COLOR, base_key, my_key))