Validate application ID and request is from Alexa.
511207
def request(self, app_id=None, body=None, stamp=None, url=None, sig=None):
        """"""
        if self.app_id:
            if not self.application_id(app_id):
                return False

        if (url or sig):
            if not (body and stamp and url and sig):
                raise ValueError('Unable to validate sender, check arguments.')
            else:
                if not self.sender(body, stamp, url, sig):
                    return False

        return True
742551
static void checkId(String id) {
    if (!ID.matcher(id).matches()) {
      throw new IllegalArgumentException(String.format("not a valid js identifier: %s", id));
    }
  }
1216217
def validate(self):
        """"""
        try:
            response = self.client.get_access_key_last_used(
                AccessKeyId=self.access_key_id
            )

            username = response['UserName']
            access_keys = self.client.list_access_keys(
                UserName=username
            )

            for key in access_keys['AccessKeyMetadata']:
                if \
                        (key['AccessKeyId'] == self.access_key_id)\
                        and (key['Status'] == 'Inactive'):
                    return True

            return False
        except Exception as e:
            logger.info(
                "Failed to validate key disable for "
                "key {id} due to: {e}.".format(
                    e=e, id=self.access_key_id
                )
            )
            return False
910122
def whoami(ctx, opts):
    """"""
    click.echo("Retrieving your authentication status from the API ... ", nl=False)

    context_msg = "Failed to retrieve your authentication status!"
    with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
        with maybe_spinner(opts):
            is_auth, username, email, name = get_user_brief()

    click.secho("OK", fg="green")
    click.echo("You are authenticated as:")
    if not is_auth:
        click.secho("Nobody (i.e. anonymous user)", fg="yellow")
    else:
        click.secho(
            "%(name)s (slug: %(username)s, email: %(email)s)"
            % {
                "name": click.style(name, fg="cyan"),
                "username": click.style(username, fg="magenta"),
                "email": click.style(email, fg="green"),
            }
        )
264508
function verify(req, identifier, profile, done) {
    var validOpEndpoint = 'https://steamcommunity.com/openid/login';
    var identifierRegex = /^https?:\/\/steamcommunity\.com\/openid\/id\/(\d+)$/;

    if(req.query['openid.op_endpoint'] !== validOpEndpoint ||
       !identifierRegex.test(identifier)) {
      return done(null, false, { message: 'Claimed identity is invalid.' });
    }

    var steamID = identifierRegex.exec(identifier)[0];

    if(options.profile) {
      getUserProfile(options.apiKey, steamID, function(err, profile) {
        if(err) {
          done(err);
        } else {
          if(originalPassReqToCallback) {
            validate(req, identifier, profile, done);
          } else {
            validate(identifier, profile, done);
          }
        }
      });
    } else {
      if(originalPassReqToCallback) {
        validate(req, identifier, profile, done);
      } else {
        validate(identifier, profile, done);
      }
    }
  }
1147465
function(input) {
		var needstesting = !this._matches.length;
		if (needstesting || this._matches.every(function(match) {
			return match.$instanceid !== input.$instanceid;
		})) {
			return this._maybeinput(input);
		}
		return false;
	}
599624
function echoRequest(body, reply) {
  console.log("agent receive: echo,   " + JS(body))
  console.log("agent reply:   echo,   " + JS(body))
  reply(null, body)

  console.log("agent emit:    echoed, " + JS(body))
  Agent.emit("echoed", body)
}
33443
def check_that_request_is_valid(signature_certificate_url, request, raw_body)
      certificate, chain = AlexaVerifier::CertificateStore.fetch(signature_certificate_url) if @configuration.verify_certificate? || @configuration.verify_signature?

      begin
        AlexaVerifier::Verifier::CertificateVerifier.valid!(certificate, chain) if @configuration.verify_certificate?

        check_that_request_was_signed(certificate.public_key, request, raw_body) if @configuration.verify_signature?
      rescue AlexaVerifier::InvalidCertificateError, AlexaVerifier::InvalidRequestError => error
        # We don't want to cache a certificate that fails our checks as it could lock us out of valid requests for the cache length
        AlexaVerifier::CertificateStore.delete(signature_certificate_url)

        raise error
      end
    end
1308187
def validate(self):
        
        endpoint = '/validate'

        payload = dict(accessToken=self.access_token)
        rep = self._ygg_req(endpoint, payload)
        return not bool(rep)
558562
def validate(self):
        
        if not self.principals:
            raise InvalidApplicationPolicyError(error_message='principals not provided')

        if not self.actions:
            raise InvalidApplicationPolicyError(error_message='actions not provided')

        if any(not self._PRINCIPAL_PATTERN.match(p) for p in self.principals):
            raise InvalidApplicationPolicyError(
                error_message='principal should be 12-digit AWS account ID or "*"')

        unsupported_actions = sorted(set(self.actions) - set(self.SUPPORTED_ACTIONS))
        if unsupported_actions:
            raise InvalidApplicationPolicyError(
                error_message='{} not supported'.format(', '.join(unsupported_actions)))

        return True
225427
def validate(identifier):
    ''''''
    source = actions.validate_source(identifier)
    log.info('Source %s (%s) has been validated', source.slug, str(source.id))
406179
def verify_verify(self, id, token):
        """"""
        return Verify().load(self.request('verify/' + str(id), params={'token': token}))
133549
def launch_request_handler(request):
    

    user_id = request.access_token()
    if user_id in twitter_cache.users():

        user_cache = twitter_cache.get_user_state(user_id)        
        user_cache["amzn_id"]= request.user_id()
        base_message = "Welcome to Twitter, {} . How may I help you today ?".format(user_cache["screen_name"])
        print (user_cache)        
        if 'pending_action' in user_cache:
            base_message += " You have one pending action . "
            print ("Found pending action")
            if 'description' in user_cache['pending_action']:
                print ("Found description")
                base_message += user_cache['pending_action']['description']
        return r.create_response(base_message)

    card = r.create_card(title="Please log into twitter", card_type="LinkAccount")
    return r.create_response(message="Welcome to twitter, looks like you haven't logged in!"
                             " Log in via the alexa app.", card_obj=card,
                             end_session=True)
537706
async function validate (args) {
    // skip if model does not have id column
    if (!defined(this.columnName('id'))) {
        return
    }
    // debug
    debug('validate '+this.name)
    // make sure args is object
    args = requireValidOptionalObject(args)
    // make sure session is object
    args.session = requireValidOptionalObject(args.session)
    // set default session id
    if (!defined(args.session.sessionId)) {
        args.session.sessionId = '11111111111111111111111111111111'
    }
    // validate data and columns
    await this.validateData(args)
    // validate deleted status if d column created
    if (this.dColumnCreated) {
        await this.validateDeleted(args)
    }
}
610663
protected function validateOnline()
    {
        try {
            $appServerService = $this->getAppServerService();
            if ($this->getConfig()->isAdmin()) {
                $appServerService->updateAppServerInformationInAdmin();
            } else {
                $appServerService->updateAppServerInformationInFrontend();
            }

            if ($this->isSendingShopDataEnabled() && !\OxidEsales\Eshop\Core\Registry::getUtils()->isSearchEngine()) {
                $this->sendShopInformation();
            }
        } catch (Exception $exception) {
            \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
        }
    }
1084636
def _validate_required_settings(
		self, application_id, application_config, required_settings
	):
		""""""

		for setting_key in required_settings:
			if setting_key not in application_config.keys():
				raise ImproperlyConfigured(
					MISSING_SETTING.format(
						application_id=application_id, setting=setting_key
					)
				)
96597
def validate_version(self, service_id, version_number):
		""""""
		content = self._fetch("/service/%s/version/%d/validate" % (service_id, version_number))
		return self._status(content)