Sets the time headers used by Acquia signature versions to the appropriate value and returns the request itself.
        These headers are X-Authorization-Timestamp (v2) and Date (v1).
332881
def with_time(self):
        
        self.header["X-Authorization-Timestamp"] = str(int(time.time()))
        self.header["Date"] = str(int(time.time()))
        return self
1191812
public ApplicationGetHeaders withLastModified(DateTime lastModified) {
        if (lastModified == null) {
            this.lastModified = null;
        } else {
            this.lastModified = new DateTimeRfc1123(lastModified);
        }
        return this;
    }
858662
function setRequestHeaders(xhr, requestData){
    var headers = {};

    if (IS_METHOD_WITH_BODY.test(requestData.method))
    {
      // when send a FormData instance, browsers serialize it and
      // set correct content-type header with boundary
      if (!FormData || requestData.body instanceof FormData == false)
        headers['Content-Type'] = requestData.contentType + (requestData.encoding ? '\x3Bcharset=' + requestData.encoding : '');
    }
    else
    {
      if (ua.test('ie')) // disable IE caching
      {
        // new Date(0).toGMTString() is not correct here;
        // IE returns date string with no leading zero and IIS may parse
        // date wrong and response with code 400
        headers['If-Modified-Since'] = 'Thu, 01 Jan 1970 00:00:00 GMT';
      }
    }

    headers = basis.object.merge(headers, requestData.headers);

    objectIterate(requestData.headers, function(name, value){
      if (name.trim().toLowerCase() == 'content-type')
      {
        /** @cut */ basis.dev.warn('basis.net.ajax: `Content-Type` header found in request data, use contentType and encoding properties instead');
        headers['Content-Type'] = value;
      }
      else
        headers[name] = value;
    });

    objectIterate(headers, function(key, value){
      if (value != null && typeof value != 'function')
        xhr.setRequestHeader(key, value);
      else
        delete headers[key];
    });

    return headers;
  }
1248678
def set_timestamp(cls, filename: str, response: HTTPResponse):
        '''
        '''
        last_modified = response.fields.get('Last-Modified')

        if not last_modified:
            return

        try:
            last_modified = email.utils.parsedate(last_modified)
        except ValueError:
            _logger.exception('Failed to parse date.')
            return

        last_modified = time.mktime(last_modified)

        os.utime(filename, (time.time(), last_modified))
270951
public function createAuthHeader()
    {
        if ($this->timestamp === null) {
            $this->setTimestamp();
        }

        if (!$this->timestamp->isValid()) {
            throw new InvalidSignDataException('Timestamp is invalid. Too old?');
        }

        if ($this->nonce === null) {
            $this->nonce = new Nonce();
        }

        $auth_header =
            'EG1-HMAC-SHA256 ' .
            'client_token=' . $this->auth['client_token'] . ';' .
            'access_token=' . $this->auth['access_token'] . ';' .
            'timestamp=' . $this->timestamp . ';' .
            'nonce=' . $this->nonce . ';';

        return $auth_header . 'signature=' . $this->signRequest($auth_header);
    }
693682
def set_response_headers(self, response: HttpResponse) -> HttpResponse:
        
        public_name = os.environ.get('SERVER_PUBLIC_NAME')
        response_headers = {
            'access-control-allow-headers': self.app.allowed_headers,
            'access-control-allow-methods': self.app.allowed_methods,
            'access-control-allow-origin': self.app.allowed_origins,
            'access-control-allow-credentials': True,
            'www-authenticate': "Bearer",
            'server-public-name': public_name if public_name else "No one",
            'user-info': "Rinzler Framework rulez!"
        }

        response_headers.update(self.app.default_headers)

        for key in response_headers:
            response[key] = response_headers[key]

        status = response.status_code
        if status != 404:
            self.app.log.info("< {0}".format(status))

        return response
37691
public function getDate(): \DateTime
    {
        /*
            RFC2616 - 14.18 says all Responses need to have a Date.
            Make sure we provide one even if it the header
            has been removed in the meantime.
         */
        if (!$this->header->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', (string) \time()));
        }

        return $this->header->getDate('Date');
    }
76340
private function createHttpHeader() {
        $nonce = mt_rand();
        $timeStamp = time();
        $sign = sha1($this->appSecret.$nonce.$timeStamp);
        return array(
                'RC-App-Key:'.$this->appKey,
                'RC-Nonce:'.$nonce,
                'RC-Timestamp:'.$timeStamp,
                'RC-Signature:'.$sign,
        );
    }
155793
def request_headers(self, request):
        
        headers = {}

        allow_origin = self.allow_origin(request)
        if allow_origin:
            headers = dict_filter({
                'Access-Control-Allow-Origin': allow_origin,
                'Access-Control-Allow-Credentials': {True: 'true', False: 'false'}.get(self.allow_credentials),
                'Access-Control-Expose-Headers': ', '.join(self.expose_headers) if self.expose_headers else None,
            })

        return headers
466857
def certify_time(value, required=True):
    
    if certify_required(
        value=value,
        required=required,
    ):
        return

    if not isinstance(value, time):
        raise CertifierTypeError(
            message="expected timestamp (time), but value is of type {cls!r}".format(
                cls=value.__class__.__name__),
            value=value,
            required=required,
        )
1055623
public CertificateGetHeaders withLastModified(DateTime lastModified) {
        if (lastModified == null) {
            this.lastModified = null;
        } else {
            this.lastModified = new DateTimeRfc1123(lastModified);
        }
        return this;
    }
1348869
protected function sign($timestamp = null) {
		if (is_null($timestamp)) $timestamp = date('c');

		$input = sha1(print_r($this->auth, true));
		$hash = $this->hash($input, $timestamp, $this->env['security_iteration'], $this->env['security_salt']);

		return $hash;
	}
1372892
def _default_request_kwargs(self):
        """"""
        defaults = copy.deepcopy(super(Acls, self)._default_request_kwargs)
        defaults.setdefault('headers', {}).update({
            'X-Auth-Token': self._client.auth._token
        })
        return defaults
817927
def aws_v4_signature
      date = OpenSSL::HMAC.digest('sha256', 'AWS4' + @secret_key, @timestamp.strftime('%Y%m%d'))
      region = OpenSSL::HMAC.digest('sha256', date, @aws_session.region)
      service = OpenSSL::HMAC.digest('sha256', region, SERVICE_NAME)
      signing_key = OpenSSL::HMAC.digest('sha256', service, 'aws4_request')

      OpenSSL::HMAC.hexdigest('sha256', signing_key, string_to_sign)
    end
361112
def __sethead(self, access_token):
        """"""
        self.access_token = access_token
        now = calendar.timegm(datetime.datetime.now().timetuple())
        self.expiration = now + 1800
        self.head = {"Authorization": "Bearer %s" % access_token,
                     "User-Agent": self.user_agent
                     }
454410
def gen_headers(opts)
      now = Time.now.httpdate
      sig = gen_signature('date: ' + now)

      headers = [[ 'Date',           now        ],
                 [ 'Authorization',  sig        ],
                 [ 'User-Agent',     HTTP_AGENT ],
                 [ 'Accept-Version', '~1.0'     ]]


       # headers for conditional requests (dates)
       for arg, conditional in [[:if_modified_since,   'If-Modified-Since'  ],
                                [:if_unmodified_since, 'If-Unmodified-Since']]
        date = opts[arg]
        next unless date

        date = Time.parse(date.to_s) unless date.kind_of? Time
        headers.push([conditional, date])
      end

      # headers for conditional requests (etags)
      for arg, conditional in [[:if_match,      'If-Match'     ],
                               [:if_none_match, 'If-None-Match']]
        etag = opts[arg]
        next unless etag

        raise ArgumentError unless etag.kind_of? String
        headers.push([conditional, etag])
      end

      origin = opts[:origin]
      if origin
        raise ArgumentError unless origin == 'null' || origin =~ CORS_ORIGIN_REGEX
        headers.push([ 'Origin',  origin ])
      end

      custom_headers = opts.keys.select { |key| key.to_s.start_with? 'm_' }
      unless custom_headers.empty?
        headers += custom_headers.map do |header_key|
          [ symbol_to_header(header_key), opts[header_key] ]
        end
      end

      # add md5 hash when sending data
      data = opts[:data]
      if data
        md5 = Digest::MD5.base64digest(data)
        headers.push([ 'Content-MD5', md5 ])
      end

      return headers
    end
212857
public JWTPayload setIssuedAtTimeSeconds(Long issuedAtTimeSeconds) {
        this.issuedAtTimeSeconds = issuedAtTimeSeconds;
        this.put(PayloadConstants.ISSUED_AT_TIME_IN_SECS, issuedAtTimeSeconds);
        return this;
    }