Sha256: db9e0151b293d05d5d41e2e3debd1b784b21cba18fc736bfb18a7a023a3c5cbc

Contents?: true

Size: 1.32 KB

Versions: 30

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Rack::OAuth2::AccessToken::MAC::Signature do

  # From the example of MAC spec section 1.2
  # ref) http://tools.ietf.org/pdf/draft-ietf-oauth-v2-http-mac-00.pdf
  context 'when body_hash is given' do
    subject do
      Rack::OAuth2::AccessToken::MAC::Signature.new(
        :secret      => '8yfrufh348h',
        :algorithm   => 'hmac-sha-1',
        :nonce       => '273156:di3hvdf8',
        :method      => 'POST',
        :request_uri => '/request',
        :host        => 'example.com',
        :port        => 80,
        :body_hash   => 'k9kbtCIy0CkI3/FEfpS/oIDjk6k=',
        :ext         => nil
      )
    end
    its(:calculate) { should == 'W7bdMZbv9UWOTadASIQHagZyirA=' }
  end

  # From the example of MAC spec section 3.2
  # ref) http://tools.ietf.org/pdf/draft-ietf-oauth-v2-http-mac-00.pdf
  context 'otherwize' do
    subject do
      Rack::OAuth2::AccessToken::MAC::Signature.new(
        :secret      => '489dks293j39',
        :algorithm   => 'hmac-sha-1',
        :nonce       => '264095:dj83hs9s',
        :method      => 'GET',
        :request_uri => '/resource/1?b=1&a=2',
        :host        => 'example.com',
        :port        => 80,
        :body_hash   => nil,
        :ext         => nil
      )
    end
    its(:calculate) { should == 'SLDJd4mg43cjQfElUs3Qub4L6xE=' }
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rack-oauth2-0.14.4 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.14.3 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.14.2 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.14.1 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.14.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.13.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.12.2 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.12.1 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.12.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.11.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.10.1 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.10.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.10.0.alpha spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.5 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.4 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.3 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.2 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.1 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.0 spec/rack/oauth2/access_token/mac/signature_spec.rb
rack-oauth2-0.9.0.alpha spec/rack/oauth2/access_token/mac/signature_spec.rb