Sha256: f6a27819cd3c7d5d2d6525d67953d5603a3feacfdf77057408d8fa9db888e44a

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

require "azure/configuration"
require "azure/service_bus/auth/wrap_token_manager"

module Azure
  module ServiceBus
    module Auth
      # Signing strategy for WRAP
      #
      class Wrap
        # Public: Initialize the Signer.
        #
        # issuer      -
        # access_key  - The Azure ServiceBus access_key encoded in Base64.
        def initialize(issuer=Azure.config.sb_issuer, access_key=Azure.config.sb_access_key, token_manager=nil)
          @wrap_token_manager = token_manager || WrapTokenManager.new(issuer, access_key)
        end

        # Public: The name of the strategy.
        #
        # Returns a String.
        def name
          "Wrap"
        end

        # Public: Generate a request signature.
        #
        # request - The HTTP request
        #
        # Returns a String
        def sign(request)
          access_token = @wrap_token_manager.get_access_token(request.uri)
          'WRAP access_token="%s"' % access_token
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 lib/azure/service_bus/auth/wrap.rb
azure-0.1.0 lib/azure/service_bus/auth/wrap.rb