Class: Configuration::ValidateHeaderHMAC

Inherits:
ValidateHMAC show all
Defined in:
lib/httpimagestore/configuration/validate_hmac.rb

Instance Attribute Summary

Attributes inherited from ValidateHMAC

#digest

Class Method Summary collapse

Methods inherited from ValidateHMAC

#initialize, new_with_common_options, #realize

Methods inherited from Scope

#initialize, node_parsers, #parse, register_node_parser

Constructor Details

This class inherits a constructor from Configuration::ValidateHMAC

Class Method Details

.match(node) ⇒ Object



152
153
154
# File 'lib/httpimagestore/configuration/validate_hmac.rb', line 152

def self.match(node)
	node.name == 'validate_header_hmac'
end

.parse(configuration, node) ⇒ Object



156
157
158
159
160
161
162
163
# File 'lib/httpimagestore/configuration/validate_hmac.rb', line 156

def self.parse(configuration, node)
	header_name, hmac_qs_param_name = *node.grab_values('header name', 'hmac')
	header_name = header_name.upcase.gsub('_', '-')
	obj = self.new_with_common_options(configuration, node, hmac_qs_param_name, ->(obj, request_state){
		request_state.request_headers[header_name] or raise HMACMissingHeaderError.new(obj.digest, header_name)
	})
	configuration.validators << obj
end