Sha256: b51fb32333da4da6c3bcbfa9fc6b90735886250eb64034b984091bbaf17d508a

Contents?: true

Size: 607 Bytes

Versions: 2

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

module Keycard::Request
  # This class should be used to extract attributes when the application will
  # serve HTTP requests directly or through a proxy that passes trusted
  # values into the application environment to be accessed as usual.
  class DirectAttributes < Attributes
    def base
      {
        user_pid:  user_pid,
        user_eid:  user_eid,
        client_ip: client_ip
      }
    end

    def user_pid
      get 'REMOTE_USER'
    end

    def user_eid
      user_pid
    end

    def client_ip
      safe('REMOTE_ADDR').split(',').first
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
keycard-0.3.0 lib/keycard/request/direct_attributes.rb
keycard-0.2.4 lib/keycard/request/direct_attributes.rb