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

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

Direct Known Subclasses

SharedKeyLite

Instance Attribute Summary collapse

Attributes inherited from Core::Auth::Signer

#access_key

Instance Method Summary collapse

Methods inherited from Auth::SharedKey

#canonicalized_headers, #initialize, #name, #sign, #sign_request

Methods inherited from Core::Auth::Signer

#initialize, #sign

Constructor Details

This class inherits a constructor from Azure::Storage::Auth::SharedKey

Instance Attribute Details

#account_nameObject (readonly)

The account name


23
24
25
# File 'lib/azure/storage/table/auth/shared_key.rb', line 23

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.


47
48
49
50
51
52
53
54
# File 'lib/azure/storage/table/auth/shared_key.rb', line 47

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.


32
33
34
35
36
37
38
39
40
# File 'lib/azure/storage/table/auth/shared_key.rb', line 32

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