Class: Azure::ServiceBus::Auth::WrapSigner
- Inherits:
-
Core::Auth::Signer
- Object
- Core::Auth::Signer
- Azure::ServiceBus::Auth::WrapSigner
- Defined in:
- lib/azure/service_bus/auth/wrap_signer.rb
Instance Attribute Summary collapse
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(host = nil, options = {}) ⇒ WrapSigner
constructor
A new instance of WrapSigner.
- #name ⇒ Object
- #sign(method, uri, headers) ⇒ Object
- #sign_request(req) ⇒ Object
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, ={}) client = ([:client] || Azure) host = host || client.acs_host @tokens = {} @wrap_service = Azure::ServiceBus::Auth::WrapService.new(host, nil, nil, ) end |
Instance Attribute Details
#tokens ⇒ Object
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
#name ⇒ Object
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 |