module MAuth::Signed
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
Public Instance Methods
fall_back_to_mws_signature_info()
click to toggle source
# File lib/mauth/request_and_response.rb, line 143 def fall_back_to_mws_signature_info @signature_info = build_signature_info(x_mws_data) end
protocol_version()
click to toggle source
# File lib/mauth/request_and_response.rb, line 159 def protocol_version if !mcc_authentication.to_s.strip.empty? 2 elsif !x_mws_authentication.to_s.strip.empty? 1 end end
signature()
click to toggle source
# File lib/mauth/request_and_response.rb, line 155 def signature signature_info[:signature] end
signature_app_uuid()
click to toggle source
# File lib/mauth/request_and_response.rb, line 147 def signature_app_uuid signature_info[:app_uuid] end
signature_info()
click to toggle source
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.
# File lib/mauth/request_and_response.rb, line 139 def signature_info @signature_info ||= build_signature_info(mcc_data || x_mws_data) end
signature_token()
click to toggle source
# File lib/mauth/request_and_response.rb, line 151 def signature_token signature_info[:token] end
Private Instance Methods
build_signature_info(match_data)
click to toggle source
# File lib/mauth/request_and_response.rb, line 169 def build_signature_info(match_data) match_data ? { token: match_data[1], app_uuid: match_data[2], signature: match_data[3] } : {} end
mcc_data()
click to toggle source
# File lib/mauth/request_and_response.rb, line 173 def mcc_data mcc_authentication&.match( /\A(#{MAuth::Client::MWSV2_TOKEN}) ([^:]+):([^:]+)#{MAuth::Client::AUTH_HEADER_DELIMITER}\z/ ) end
x_mws_data()
click to toggle source
# File lib/mauth/request_and_response.rb, line 179 def x_mws_data x_mws_authentication&.match(/\A([^ ]+) *([^:]+):([^:]+)\z/) end