Sha256: f9195e8453df1f5bb3390c7eefb9dc6c05bb3e3800d9ed1bd8580683a20fe4fd

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

require 'uri'

module XSignature
  class RailsRequestValidator < RequestValidator

    def validate(secret:, request:)
      env  = request.env
      body = request.body
      if body.kind_of?(StringIO)
        body = body.string
      end
      request_uri = (URI(env['REQUEST_URI']).request_uri rescue env['REQUEST_URI'])
      params      = {
        secret:      secret,
        signature:   env[XSignature.signature_header],
        client:      env[XSignature.client_header],
        nonce:       env[XSignature.nonce_header],
        method:      request.method,
        request_uri: request_uri,
        body:        body,
      }
      super params
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
x-signature-0.1.1 lib/x-signature/rails_request_validator.rb