Module: MAuth::Signed
- Included in:
- Faraday::Response, Rack::Request
- Defined in:
- lib/mauth/request_and_response.rb
Overview
methods for an incoming object which is expected to have a signature.
includer must provide
-
#mcc_authentication which returns that header’s value
-
#mcc_time
OR
-
#x_mws_authentication which returns that header’s value
-
#x_mws_time
Instance Method Summary collapse
- #fall_back_to_mws_signature_info ⇒ Object
- #protocol_version ⇒ Object
- #signature ⇒ Object
- #signature_app_uuid ⇒ Object
-
#signature_info ⇒ Object
mauth_client will authenticate with the highest protocol version present and if authentication fails, will fall back to lower protocol versions (if provided).
- #signature_token ⇒ Object
Instance Method Details
#fall_back_to_mws_signature_info ⇒ Object
151 152 153 |
# File 'lib/mauth/request_and_response.rb', line 151 def fall_back_to_mws_signature_info @signature_info = build_signature_info(x_mws_data) end |
#protocol_version ⇒ Object
167 168 169 170 171 172 173 |
# File 'lib/mauth/request_and_response.rb', line 167 def protocol_version if !mcc_authentication.to_s.strip.empty? 2 elsif !x_mws_authentication.to_s.strip.empty? 1 end end |
#signature ⇒ Object
163 164 165 |
# File 'lib/mauth/request_and_response.rb', line 163 def signature signature_info[:signature] end |
#signature_app_uuid ⇒ Object
155 156 157 |
# File 'lib/mauth/request_and_response.rb', line 155 def signature_app_uuid signature_info[:app_uuid] end |
#signature_info ⇒ Object
mauth_client will authenticate with the highest protocol version present and if authentication fails, will fall back to lower protocol versions (if provided). returns a hash with keys :token, :app_uuid, and :signature parsed from the MCC-Authentication header if it is present and if not then the X-MWS-Authentication header if it is present. Note MWSV2 protocol no longer allows more than one space between the token and app uuid.
147 148 149 |
# File 'lib/mauth/request_and_response.rb', line 147 def signature_info @signature_info ||= build_signature_info(mcc_data || x_mws_data) end |
#signature_token ⇒ Object
159 160 161 |
# File 'lib/mauth/request_and_response.rb', line 159 def signature_token signature_info[:token] end |