Class: Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner

Inherits:
Core::Auth::Signer
  • Object
show all
Defined in:
lib/azure/storage/common/core/auth/shared_access_signature_signer.rb

Instance Attribute Summary collapse

Attributes inherited from Core::Auth::Signer

#access_key

Instance Method Summary collapse

Methods inherited from Core::Auth::Signer

#sign

Constructor Details

#initialize(api_ver, account_name = "", sas_token = "") ⇒ SharedAccessSignatureSigner

Public: Initialize the Signer with a SharedAccessSignature

Parameters:

  • api_ver (String)

    The api version of the service.

  • account_name (String) (defaults to: "")

    The account name. Defaults to the one in the global configuration.

  • sas_token (String) (defaults to: "")

    The sas token to be used for signing



40
41
42
43
44
45
46
47
48
49
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 40

def initialize(api_ver,  = "", sas_token = "")
  if .empty? || sas_token.empty?
    client = Azure::Storage::Common::Client.create_from_env
     = client. if .empty?
    sas_token = client.storage_sas_token if sas_token.empty?
  end
  @api_ver = api_ver
  @account_name = 
  @sas_token = sas_token
end

Instance Attribute Details

#account_nameObject (readonly)

Returns the value of attribute account_name.



32
33
34
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 32

def 
  @account_name
end

#api_verObject

Returns the value of attribute api_ver.



33
34
35
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 33

def api_ver
  @api_ver
end

Instance Method Details

#sign_request(req) ⇒ Object



51
52
53
54
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 51

def sign_request(req)
  req.uri = URI.parse(req.uri.to_s + (req.uri.query.nil? ? "?" : "&") + sas_token.sub(/^\?/, "") + "&api-version=" + @api_ver)
  req
end