Sha256: 36ca3a80f9fd78cc23dd4e353135ed40dd5ec1f4443f4916267a21329a817adf

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

class RequestUtils
  SECURENATIVE_COOKIE = '_sn'.freeze
  SECURENATIVE_HEADER = 'x-securenative'.freeze

  def self.get_secure_header_from_request(headers)
    return headers[RequestUtils.SECURENATIVE_HEADER] unless headers.nil?

    []
  end

  def self.get_client_ip_from_request(request)
    x_forwarded_for = request.env['HTTP_X_FORWARDED_FOR']
    return x_forwarded_for unless x_forwarded_for.nil?

    request.env['REMOTE_ADDR']
  end

  def self.get_remote_ip_from_request(request)
    request.remote_ip
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
securenative-0.1.17 lib/securenative/utils/request_utils.rb
securenative-0.1.16 lib/securenative/utils/request_utils.rb