Sha256: 1a92cf2fb9420ff0c0b05dad3748508b5bda7f0d51b7345d0de52a2017002a6f

Contents?: true

Size: 948 Bytes

Versions: 7

Compression:

Stored size: 948 Bytes

Contents

module Rack
  module OAuth2
    module Server
      class Resource
        class MAC < Resource
          def call(env)
            self.request = Request.new(env)
            super
          end

          private

          class Request < Resource::Request
            attr_reader :timestamp, :nonce, :body_hash, :signature

            def setup!
              auth_params = Rack::Auth::Digest::Params.parse(@auth_header.params).with_indifferent_access
              @access_token = auth_params[:token]
              @timestamp = auth_params[:timestamp]
              @nonce = auth_params[:nonce]
              @body_hash = auth_params[:bodyhash]
              @signature = auth_params[:signature]
              self
            end

            def oauth2?
              @auth_header.provided? && @auth_header.scheme == :mac
            end
          end
        end
      end
    end
  end
end

require 'rack/oauth2/server/resource/mac/error'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rack-oauth2-0.6.9 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.8 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.7 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.6 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.5 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.4 lib/rack/oauth2/server/resource/mac.rb
rack-oauth2-0.6.3 lib/rack/oauth2/server/resource/mac.rb