make sure that apiKey and basicAuth are empty list
        in Operation object.
16962
def _validate_auths(self, path, obj, app):
        
        errs = []

        for k, v in six.iteritems(obj.authorizations or {}):
            if k not in app.raw.authorizations:
                errs.append('auth {0} not found in resource list'.format(k))

            if app.raw.authorizations[k].type in ('basicAuth', 'apiKey') and v != []:
                errs.append('auth {0} should be an empty list'.format(k))

        return path, obj.__class__.__name__, errs
1232472
public void setApiKey(String apiKey) {
        for (Authentication auth : authentications.values()) {
            if (auth instanceof ApiKeyAuth) {
                ((ApiKeyAuth) auth).setApiKey(apiKey);
                return;
            }
        }
        throw new RuntimeException("No API key authentication configured!");
    }
39884
def _get_list(self, key, operation, create=False):
        
        return self._get_by_type(key, operation, create, b'list', [])
831483
function useBasicAuth() {
  return new Promise((resolve, reject) => {
    if (!defaults.userToken || !defaults.masterToken) {
      reject(__generateFakeResponse__(0, '', {}, 'userToken or masterToken are missing for basic authentication'))
    }
    else {
      let details = {
        "token_type": "Basic",
        "expires_in": 0,
        "appName": defaults.appName,
        "username": "",
        "role": "",
        "firstName": "",
        "lastName": "",
        "fullName": "",
        "regId": 0,
        "userId": null
      };
      let basicToken = 'Basic ' + createBasicToken(defaults.masterToken, defaults.userToken);
      utils.storage.set('user', {
        token: {
          Authorization:  basicToken
        },
        details: details
      });
      resolve(__generateFakeResponse__(200, 'OK', {}, details, {}));
    }
  });

}
163326
def check_read_httpauth_access(func):
    

    def wrapper(request, *args, **kwargs):
        database_name = kwargs.get('database_name', "")
        collection_name = kwargs.get('collection_name', "")
        if not database_name or not collection_name:
            return HttpResponse(unauthorized_json_response(),
                                content_type="application/json")

        try:
            # Check to see if we have a matching record in DB access.
            dac = HTTPAuthReadAPI.objects.get(
                database_name=database_name, collection_name=collection_name)
        except HTTPAuthReadAPI.DoesNotExist:
            return HttpResponse(unauthorized_json_response(),
                                content_type="application/json")

        dac_groups = dac.groups.all()
        user_groups = request.user.groups.all()

       # allowedgroups
        in_group = False
        group = None
        for dg in dac_groups:
            if dg in user_groups:
                in_group = True
                group = dg

        if not in_group:
            message = "NOT-IN-GROUP: You do not have access to this collection. Please see your system administrator."

            body = {"code": 400,
                    "message": message,
                    "errors": [message, ]}
            return HttpResponse(json.dumps(body, indent=4, ),
                                content_type="application/json")

        # If search keys have been limitied...
        if dac.search_keys:
            search_key_list = shlex.split(dac.search_keys)
            keys = []
            for k in request.GET.keys():

                if k not in search_key_list:
                    message = "Search key %s  is not allowed." % (k)

                    body = {"code": 400,
                            "message": k,
                            "errors": [message, ]}

                    return HttpResponse(json.dumps(body, indent=4, ),
                                        content_type="application/json")

        return func(request, *args, **kwargs)

    return update_wrapper(wrapper, func)
278590
protected void registerSecurity(Swagger swagger, Operation operation, Method method) {
        RequireToken requireToken = ClassUtil.getAnnotation(method, RequireToken.class);
        if (requireToken != null) {
            String apiKeyName = requireToken.value();
            if (swagger.getSecurityDefinitions() == null || !swagger.getSecurityDefinitions().containsKey(apiKeyName)) {
                ApiKeyAuthDefinition security = new ApiKeyAuthDefinition();
                security.setName(apiKeyName);
                security.setIn(In.HEADER);
                security.setType("apiKey");
                swagger.addSecurityDefinition(apiKeyName, security);
            }

            operation.addSecurity(apiKeyName, Collections.emptyList());
        }

        BasicAuth basicAuth = ClassUtil.getAnnotation(method, BasicAuth.class);
        if (basicAuth != null) {
            if (swagger.getSecurityDefinitions() == null || !swagger.getSecurityDefinitions().containsKey("basic")) {
                BasicAuthDefinition security = new BasicAuthDefinition();
                swagger.addSecurityDefinition("basic", security);
            }

            operation.addSecurity("basic", Collections.emptyList());
        }
    }
264952
function UnloqApi(authObj) {
    if(typeof authObj !== 'object' || authObj === null) {
      throw new Error('Unloq.Api: First constructor argument must be an instance of unloq.Auth');
    }
    // If we receive only the object with configuration, we try and create the auth object.
    if(authObj.__type !== 'auth') {
      var AuthClass = Auth();
      authObj = new AuthClass(authObj);
    }
    auth = authObj;
  }
406489
def do(self, params):
        """"""
        request_params = self.create_basic_params()
        request_params.update(params)
        response_data = self.request(request_params)
        try:
            format_json_data = self.format_response_data(response_data)
        # pylint: disable=broad-except
        except Exception:
            # Caused by server force logged out
            return None
        return_data = self.fix_error_data(format_json_data)
        try:
            self.check_login_status(return_data)
        except exceptions.NotLoginError:
            self.autologin()
        return return_data
600620
def empty(key, dict):
    
    if key in dict.keys():
        if dict[key]:
            return False
    return True
188330
def check_basic_auth(self, username, password):
        
        valid = self.users.check_password(
            username, password
        )
        if not valid:
            log.warning('Invalid login from %s', username)
            valid = False
        return (
            valid,
            username
        )
455542
def authenticate(self, api_key):
        """"""
        self._api_key = api_key

        # Attach auth to session.
        self._session.auth = ('', self._api_key)

        return self._verify_api_key()
921236
def check_exists_in_object(method, obj, required_fields):
    
    missing = []
    for field in required_fields:
        if getattr(obj, field) is None:
            missing.append(field)
    if missing:
        raise PyCronofyValidationError('Method: %s. Missing auth field(s): %s' % (method, missing),
                                       method,
                                       missing
                                       )
313885
def then_the_return_element_have_no_key(context, line, key):
    
    line = int(line)
    data = context.apiRequest.data
    assert 0 <= line < len(data)
    assert key not in data[line]
1068558
function isEmpty(obj) {
  for (var key in obj) if (__own.call(obj, key)) {
    return false;
  }
  return true;
}
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
1165360
def build_api_object(uo=None, api_key=None, uo_id=None, uo_type=None):
        
        if uo is not None:
            api_key = uo.resolve_api_key() if uo.resolve_api_key() is not None else api_key
            uo_id = uo.uo_id if uo.uo_id is not None else uo_id
            uo_type = uo.uo_type if uo.uo_type is not None else uo_type

        if uo_type is None or uo_type == EBConsts.INVALID_KEY_TYPE:
            uo_type = 0

        return "%s%010x%010x" % (api_key, uo_id, uo_type)
1311112
def basic_auth(user, password, realm=None):
    
    from neobolt.security import AuthToken
    return AuthToken("basic", user, password, realm)