class MAuth::Rack::ResponseSigner

signs outgoing responses with only the protocol used to sign the request.

Public Instance Methods

call(env) click to toggle source
# File lib/mauth/rack.rb, line 94
def call(env)
  unsigned_response = @app.call(env)

  method =
    if env['mauth.protocol_version'] == 2
      :signed_v2
    elsif env['mauth.protocol_version'] == 1
      :signed_v1
    else
      # if no protocol was supplied then use `signed` which either signs
      # with both protocol versions (by default) or only v2 when the
      # v2_only_sign_requests flag is set to true.
      :signed
    end
  response = mauth_client.send(method, MAuth::Rack::Response.new(*unsigned_response))
  response.status_headers_body
end