Sha256: 10b7a3049045e81aae4ca2e7ed478affe5c577a19ee2ac6d351294f2418e8bc3
Contents?: true
Size: 857 Bytes
Versions: 9
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true require 'rack/request' module Rack module Auth class AbstractRequest def initialize(env) @env = env end def request @request ||= Request.new(@env) end def provided? !authorization_key.nil? && valid? end def valid? !@env[authorization_key].nil? end def parts @parts ||= @env[authorization_key].split(' ', 2) end def scheme @scheme ||= parts.first && parts.first.downcase end def params @params ||= parts.last end private AUTHORIZATION_KEYS = ['HTTP_AUTHORIZATION', 'X-HTTP_AUTHORIZATION', 'X_HTTP_AUTHORIZATION'] def authorization_key @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems