Sha256: cc9a64aff40ae41a1e08e9ad120d926c7ade174c4f6e2f351c0d78310c4263c8

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module Keycard::Request
  # This class extracts attributes for Cosign-protected applications. It
  # follows the same basic pattern as for general proxied requests; that is,
  # the pid/eid are the same and there are currently no additional
  # attributes extracted.
  class CosignAttributes < Attributes
    def base
      {
        user_pid:  user_pid,
        user_eid:  user_eid,
        client_ip: client_ip
      }
    end

    def user_pid
      request.env['HTTP_X_REMOTE_USER']
    end

    def user_eid
      user_pid
    end

    def client_ip
      (request.env['HTTP_X_FORWARDED_FOR'] || '').split(',').first
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keycard-0.2.3 lib/keycard/request/cosign_attributes.rb
keycard-0.2.2 lib/keycard/request/cosign_attributes.rb
keycard-0.2.1 lib/keycard/request/cosign_attributes.rb
keycard-0.2.0 lib/keycard/request/cosign_attributes.rb