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.



123
124
125
# File 'lib/mauth/rack.rb', line 123

def initialize(env)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



121
122
123
# File 'lib/mauth/rack.rb', line 121

def env
  @env
end

Instance Method Details

#attributes_for_signingObject



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/mauth/rack.rb', line 127

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



153
154
155
# File 'lib/mauth/rack.rb', line 153

def mcc_authentication
  @env['HTTP_MCC_AUTHENTICATION']
end

#mcc_timeObject



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

def mcc_time
  @env['HTTP_MCC_TIME']
end

#x_mws_authenticationObject



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

def x_mws_authentication
  @env['HTTP_X_MWS_AUTHENTICATION']
end

#x_mws_timeObject



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

def x_mws_time
  @env['HTTP_X_MWS_TIME']
end