Module: Shared::HmacSignature
- Included in:
- PushyDaemon::Consumer
- Defined in:
- lib/shared/hmac_signature.rb
Instance Method Summary collapse
Instance Method Details
#headers_md5(headers, payload) ⇒ Object
32 33 34 |
# File 'lib/shared/hmac_signature.rb', line 32 def headers_md5 headers, payload headers['Content-MD5'] = Digest::MD5.hexdigest(payload.to_s) end |
#headers_sign(headers, config, names = ['date']) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shared/hmac_signature.rb', line 7 def headers_sign headers, config, names = ['date'] # Extract and check return unless config.is_a? Hash hmac_method = config[:method] hmac_user = config[:user] hmac_secret = config[:secret] #log_debug "headers_sign config", config # Check params unless config[:method] && config[:user] && config[:secret] log_error "headers_sign: missing method/user/secret" return end # Check params unless config[:method] == 'hmac-kong' log_error "headers_sign: only [hmac-kong] method is supported" return end # OK, lets go hmac_sign_kong headers, config[:user], config[:secret], names # log_info "headers_sign: after signing", headers end |