Sha256: 109414837da99fb82d04ca531fe4f5dc235807005c225f0b79a3e2f84484ea3f

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 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
      get 'HTTP_X_REMOTE_USER'
    end

    def user_eid
      user_pid
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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