class GrapeAPISignature::AWSAuthParser
Attributes
str[RW]
Public Class Methods
new(str)
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 9 def initialize(str) self.str = str end
parse(str)
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 5 def self.parse(str) new(str).parse end
Public Instance Methods
access_key()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 17 def access_key credential_str.split('/', 2)[0] end
credential()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 21 def credential credential_str.split('/', 2)[1] end
credential_str()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 33 def credential_str params['Credential'] || 'NOT_PROVIDED/NOT_PROVIDED/NOT_PROVIDED/NOT_PROVIDED/NOT_PROVIDED' end
param_str()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 53 def param_str @param_str ||= str.split(' ', 2)[1] end
params()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 37 def params @params ||= parse_params end
parse()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 13 def parse self.authorization = AWSAuthorization.new(access_key, credential, signed_headers, signature) end
parse_params()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 41 def parse_params param_str.split(',').each_with_object({}) do |data, result| (key, value) = data.split('=') value ||= '' result[key.strip] = value.strip end end
sig_type()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 49 def sig_type @sig_type ||= str.split(' ', 2)[0] end
signature()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 29 def signature params['Signature'] || 'NOT_PROVIDED' end
signed_headers()
click to toggle source
# File lib/grape_api_signature/aws_auth_parser.rb, line 25 def signed_headers (params['SignedHeaders'] || '').split(';').map(&:strip) end