Class: Azure::Storage::Table::Auth::SharedKey

Inherits:
Common::Core::Auth::SharedKey
  • Object
show all
Defined in:
lib/azure/storage/table/auth/shared_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#account_nameObject (readonly)

The account name



34
35
36
# File 'lib/azure/storage/table/auth/shared_key.rb', line 34

def 
  @account_name
end

Instance Method Details

#canonicalized_resource(uri) ⇒ String

Calculate the Canonicalized Resource string for a request.

Parameters:

  • uri (URI)

    The request’s URI.

Returns:

  • (String)

    with the canonicalized resource.



58
59
60
61
62
63
64
65
# File 'lib/azure/storage/table/auth/shared_key.rb', line 58

def canonicalized_resource(uri)
  resource = "/#{}#{uri.path}"

  comp = CGI.parse(uri.query.to_s).fetch("comp", nil)
  resource = [resource, "comp=" + comp[0]].join("?") if comp

  resource
end

#signable_string(method, uri, headers) ⇒ Object

Generate the string to sign.

Returns a plain text string.

Parameters:

  • method (Symbol)

    The HTTP request method.

  • uri (URI)

    The URI of the request we’re signing.

  • headers (Hash)

    The HTTP request headers.



43
44
45
46
47
48
49
50
51
# File 'lib/azure/storage/table/auth/shared_key.rb', line 43

def signable_string(method, uri, headers)
  [
      method.to_s.upcase,
      headers.fetch("Content-MD5", ""),
      headers.fetch("Content-Type", ""),
      headers.fetch("Date") { headers.fetch("x-ms-date") },
      canonicalized_resource(uri)
  ].join("\n")
end