Sha256: 199471bf821c36d3ee348537feedf112d9ea70982e22097289e36b3104765b90
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' describe Rack::OAuth2::AccessToken::Authenticator do let(:resource_endpoint) { 'https://server.example.com/resources/fake' } let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) } let(:authenticator) { Rack::OAuth2::AccessToken::Authenticator.new(token) } shared_examples_for :authenticator do it 'should let the token authenticate the request' do expect(token).to receive(:authenticate).with(request) authenticator.filter_request(request) end end context 'when Legacy token is given' do let(:token) do Rack::OAuth2::AccessToken::Legacy.new( :access_token => 'access_token' ) end it_behaves_like :authenticator end context 'when Bearer token is given' do let(:token) do Rack::OAuth2::AccessToken::Bearer.new( :access_token => 'access_token' ) end it_behaves_like :authenticator end context 'when MAC token is given' do let(:token) do Rack::OAuth2::AccessToken::MAC.new( :access_token => 'access_token', :mac_key => 'secret', :mac_algorithm => 'hmac-sha-256' ) end it_behaves_like :authenticator end end
Version data entries
4 entries across 4 versions & 1 rubygems