11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/shared/hmac_signature.rb', line 11
def , config
return unless config.is_a? Hash
hmac_method = config[:method]
hmac_user = config[:user]
hmac_secret = config[:secret]
log_debug "headers_sign config", config
unless hmac_method && hmac_user && hmac_secret
log_error "headers_sign: missing method/user/secret"
return
end
unless config[:headers].is_a? Array
log_error "headers_sign: [headers] should be an array of headers to be signed"
return
end
= config[:headers].map(&:to_s)
['Date'] = Time.now.utc.strftime('%a, %d %b %Y %H:%M:%S GMT')
case hmac_method
when 'hmac-kong'
hmac_sign_kong , hmac_user, hmac_secret,
else
log_error "headers_sign: only [hmac-kong] method is supported"
return
end
end
|