Class: Rack::Reqorder::Monitor::Helpers::AuthorizationHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/reqorder/monitor/helpers.rb

Overview

taken from rails ActionController::HttpAuthentication::Token ^_^

Constant Summary collapse

TOKEN_KEY =
'token='
TOKEN_REGEX =
/^(Token|Bearer) /
AUTHN_PAIR_DELIMITERS =
/(?:,|;|\t+)/

Class Method Summary collapse

Class Method Details

.token_and_options(headers) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/rack/reqorder/monitor/helpers.rb', line 51

def token_and_options(headers)
  authorization_request = headers['Authorization']

  if authorization_request[TOKEN_REGEX]
    params = token_params_from authorization_request
    [params.shift[1], Hash[params].with_indifferent_access]
  end
end