Class: Azure::ServiceBus::Auth::WrapSigner

Inherits:
Core::Auth::Signer
  • Object
show all
Defined in:
lib/azure/service_bus/auth/wrap_signer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host = nil, options = {}) ⇒ WrapSigner

Returns a new instance of WrapSigner.



25
26
27
28
29
30
# File 'lib/azure/service_bus/auth/wrap_signer.rb', line 25

def initialize(host = nil, options={})
  client = (options[:client] || Azure)
  host = host || client.acs_host
  @tokens = {}
  @wrap_service = Azure::ServiceBus::Auth::WrapService.new(host, nil, nil, options)
end

Instance Attribute Details

#tokensObject

Returns the value of attribute tokens.



32
33
34
# File 'lib/azure/service_bus/auth/wrap_signer.rb', line 32

def tokens
  @tokens
end

Instance Method Details

#nameObject



34
35
36
# File 'lib/azure/service_bus/auth/wrap_signer.rb', line 34

def name
  'WRAP'
end

#sign(method, uri, headers) ⇒ Object



45
46
47
48
# File 'lib/azure/service_bus/auth/wrap_signer.rb', line 45

def sign(method, uri, headers)
  access_token = get_access_token(create_scope_uri(uri))
  'access_token="%s"' % access_token
end

#sign_request(req) ⇒ Object



40
41
42
43
# File 'lib/azure/service_bus/auth/wrap_signer.rb', line 40

def sign_request(req)
  signature = sign(req.method, req.uri, req.headers)
  req.headers['Authorization'] = "#{name} #{signature}"
end