class Shmac::AuthorizationHeader
Constants
- AUTH_HEADER_PATTERN
Attributes
parts[R]
Public Class Methods
generate(organization:, access_key:, signature: new("%s %s:%s" % [organization, access_key, signature]))
click to toggle source
# File lib/shmac/authorization_header.rb, line 12 def self.generate organization:, access_key:, signature: new("%s %s:%s" % [organization, access_key, signature]) end
new(value)
click to toggle source
# File lib/shmac/authorization_header.rb, line 16 def initialize value @value = value self.parts = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/shmac/authorization_header.rb, line 21 def == other return false unless other.is_a?(self.class) Security.secure_compare self.to_s, other.to_s end
access_key_id()
click to toggle source
# File lib/shmac/authorization_header.rb, line 44 def access_key_id parts[2] end
organization()
click to toggle source
# File lib/shmac/authorization_header.rb, line 40 def organization parts[1] end
parts=(value)
click to toggle source
# File lib/shmac/authorization_header.rb, line 31 def parts= value matches = AUTH_HEADER_PATTERN.match(value) unless matches raise FormatError.new("#{value} does not match the expected authorization signature") end @parts = matches end
signature()
click to toggle source
# File lib/shmac/authorization_header.rb, line 48 def signature parts[3] end
to_s()
click to toggle source
# File lib/shmac/authorization_header.rb, line 27 def to_s @value end