Sha256: 51a2055d4886f1592f66dd20929434b6303a23246799c8c44f9fc91434561a79
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module DvelpApiAuth module Authentication class ApiRequest include ::DvelpApiAuth::HelperMethods attr_reader :api_request def initialize(api_request) @api_request = api_request end def valid? DvelpApiAuth::Authentication::Validator.new( client_authorization_code, timestamp, server_signature ).authentic? end def server_signature DvelpApiAuth::Authentication::Signature.new( fullpath, raw_post, timestamp, multipart?, body ).generate end def mulipart_server_signature; end private def timestamp api_request.headers.env['HTTP_TIMESTAMP'] end def raw_post @raw_post ||= api_request.raw_post end def fullpath @full_path ||= api_request.fullpath end def body @body ||= api_request.body end def multipart? present?(api_request.headers['Content-Type']) && api_request.headers['Content-Type'].try(:include?, 'multipart') end def client_authorization_code api_request.headers.env['HTTP_AUTHORISATION'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dvelp_api_auth-0.5.0 | lib/dvelp_api_auth/authentication/api_request.rb |
dvelp_api_auth-0.1.0 | lib/dvelp_api_auth/authentication/api_request.rb |