Class: MAuth::Rack::Request

Inherits:
MAuth::Request show all
Includes:
Signed
Defined in:
lib/mauth/rack.rb

Overview

representation of a request composed from a rack request env which can be passed to a Mauth::Client for authentication

Constant Summary

Constants inherited from MAuth::Request

MAuth::Request::SIGNATURE_COMPONENTS, MAuth::Request::SIGNATURE_COMPONENTS_V2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Signed

#fall_back_to_mws_signature_info, #protocol_version, #signature, #signature_app_uuid, #signature_info, #signature_token

Methods included from Signable

#normalize_path, #string_to_sign_v1, #string_to_sign_v2, #unescape_encode_query_string, #uri_escape

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



118
119
120
# File 'lib/mauth/rack.rb', line 118

def initialize(env)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



117
118
119
# File 'lib/mauth/rack.rb', line 117

def env
  @env
end

Instance Method Details

#attributes_for_signingObject



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/mauth/rack.rb', line 122

def attributes_for_signing
  @attributes_for_signing ||= begin
    env['rack.input'].rewind
    body = env['rack.input'].read
    env['rack.input'].rewind
    {
      verb: env['REQUEST_METHOD'],
      request_url: env['PATH_INFO'],
      body: body,
      query_string: env['QUERY_STRING']
    }
  end
end

#mcc_authenticationObject



148
149
150
# File 'lib/mauth/rack.rb', line 148

def mcc_authentication
  @env['HTTP_MCC_AUTHENTICATION']
end

#mcc_timeObject



144
145
146
# File 'lib/mauth/rack.rb', line 144

def mcc_time
  @env['HTTP_MCC_TIME']
end

#x_mws_authenticationObject



140
141
142
# File 'lib/mauth/rack.rb', line 140

def x_mws_authentication
  @env['HTTP_X_MWS_AUTHENTICATION']
end

#x_mws_timeObject



136
137
138
# File 'lib/mauth/rack.rb', line 136

def x_mws_time
  @env['HTTP_X_MWS_TIME']
end