Class: XSignature::RailsRequestValidator
- Inherits:
-
RequestValidator
- Object
- RequestValidator
- XSignature::RailsRequestValidator
- Defined in:
- lib/x-signature/rails_request_validator.rb
Instance Attribute Summary
Attributes inherited from RequestValidator
#nonce_validator, #signature_validator
Instance Method Summary collapse
Methods inherited from RequestValidator
Constructor Details
This class inherits a constructor from XSignature::RequestValidator
Instance Method Details
#validate(secret:, request:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/x-signature/rails_request_validator.rb', line 6 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 |