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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Signed

#signature, #signature_app_uuid, #signature_info, #signature_token

Methods included from Signable

#string_to_sign

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



87
88
89
# File 'lib/mauth/rack.rb', line 87

def initialize(env)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



86
87
88
# File 'lib/mauth/rack.rb', line 86

def env
  @env
end

Instance Method Details

#attributes_for_signingObject



91
92
93
94
95
96
97
98
# File 'lib/mauth/rack.rb', line 91

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 }
  end
end

#x_mws_authenticationObject



104
105
106
# File 'lib/mauth/rack.rb', line 104

def x_mws_authentication
  @env['HTTP_X_MWS_AUTHENTICATION']
end

#x_mws_timeObject



100
101
102
# File 'lib/mauth/rack.rb', line 100

def x_mws_time
  @env['HTTP_X_MWS_TIME']
end