shutl_auth 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ Gemfile.lock
21
+
22
+ bin
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p327-perf
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-p327@shutl_auth"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.17.2 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - "1.9.3"
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ jdk:
7
+ - openjdk7
8
+ - oraclejdk7
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in shutl_auth.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Mark Burns
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # ShutlAuth
2
+
3
+ You probably won't use this gem directly, as it is used by the
4
+ [https://github.com/shutl/shutl_resource](shutl_resource) gem
5
+
6
+ #Configuration
7
+
8
+ ```ruby
9
+ Shutl::Auth.config do |c|
10
+ c.url = "<API_URL_GOES_HERE>"
11
+ c.client_id = "<CLIENT_ID>"
12
+ c.client_secret = "<CLIENT_SECRET>"
13
+ end
14
+ ```
15
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.rspec_opts = "--color --format doc"
7
+ end
8
+
9
+ task :test => :spec
10
+ task :default => :spec
@@ -0,0 +1,75 @@
1
+ module Shutl
2
+ module Auth
3
+ class Shutl::Error < ::StandardError; end
4
+ class InvalidUrl < Shutl::Error; end
5
+ class InvalidCredentials < Shutl::Error; end
6
+ class InternalServerError < Shutl::Error; end
7
+
8
+ def access_token!
9
+ access_token_response!.access_token
10
+ end
11
+
12
+ def access_token_response!
13
+ c = client
14
+
15
+ Shutl::NetworkRetry.retry "Authentication Service Error" do
16
+ handling_exceptions { c.access_token! }
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def handling_exceptions
23
+ yield
24
+ rescue Rack::OAuth2::Client::Error => e
25
+ case e.message
26
+ when /The client identifier provided is invalid, the client failed to authenticate, the client did not include its credentials, provided multiple client credentials, or used unsupported credentials type\./
27
+ raise_invalid_credentials
28
+ else
29
+ raise_internal_server_error e
30
+ end
31
+ end
32
+
33
+ def client
34
+ check uri
35
+
36
+ Rack::OAuth2::Client.new \
37
+ identifier: Shutl::Auth.client_id,
38
+ secret: Shutl::Auth.client_secret,
39
+ token_endpoint: '/token',
40
+ host: uri.host,
41
+ port: uri.port,
42
+ scheme: uri.scheme
43
+ end
44
+
45
+
46
+ def uri
47
+ URI Shutl::Auth.url
48
+ rescue
49
+ raise_invalid_uri
50
+ end
51
+
52
+ def check uri
53
+ return uri if uri and uri.host and uri.scheme
54
+ raise_invalid_uri
55
+
56
+ rescue
57
+ raise_invalid_uri
58
+ end
59
+
60
+ def raise_invalid_uri
61
+ raise Shutl::Auth::InvalidUrl, "Please set value of Shutl::Auth.url"
62
+ end
63
+
64
+ def raise_invalid_credentials
65
+ raise Shutl::Auth::InvalidCredentials, "Invalid credentials set, please see https://github.com/shutl/shutl_auth/blob/master/README.md"
66
+ end
67
+
68
+ def raise_internal_server_error e
69
+ Shutl.notify e
70
+ raise Shutl::Auth::InternalServerError
71
+ end
72
+
73
+ extend self
74
+ end
75
+ end
@@ -0,0 +1,41 @@
1
+ #can be included in for example a Rails controller to enable easily
2
+ #authenticating requests
3
+ module Shutl
4
+ module Auth
5
+ module Session
6
+ def session
7
+ @session ||= {}
8
+ end
9
+ end
10
+
11
+ module AuthenticatedRequest
12
+ def self.included base
13
+ unless base.instance_methods.include? :session
14
+ base.class_eval do
15
+ include Shutl::Auth::Session
16
+ end
17
+ end
18
+ end
19
+
20
+ def request_access_token
21
+ return session[:access_token] if session[:access_token]
22
+
23
+ Shutl::Auth.access_token!
24
+ end
25
+
26
+ def access_token
27
+ session[:access_token] ||= request_access_token
28
+ end
29
+
30
+ def authenticated_request &blk
31
+ begin
32
+ yield
33
+ rescue Shutl::UnauthorizedAccess => e
34
+ session[:access_token] = nil
35
+ access_token
36
+ yield
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module Shutl
2
+ module Auth
3
+ VERSION = "0.8.0"
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ module Shutl
2
+ class << self
3
+ def notifier_klass= klass
4
+ NetworkRetry.notifier_klass = klass
5
+ end
6
+
7
+ def notifier_klass
8
+ NetworkRetry.notifier_klass
9
+ end
10
+
11
+ delegate :notify, to: :notifier_klass
12
+ end
13
+
14
+ module NetworkRetry
15
+ def retry message= "Notice: Network Exception", default=nil
16
+ Retriable.retriable(retry_settings) { yield }
17
+ rescue *network_exceptions => e
18
+ notifier_klass.notify(e, error_message: message)
19
+ default
20
+ end
21
+
22
+ attr_writer :notifier_klass
23
+
24
+ def notifier_klass
25
+ @notifier_klass ||= Airbrake
26
+ end
27
+
28
+ private
29
+
30
+ def network_exceptions
31
+ [
32
+ Timeout::Error,
33
+ Errno::ECONNREFUSED,
34
+ EOFError,
35
+ Net::HTTPBadResponse,
36
+ Errno::ETIMEDOUT
37
+ ]
38
+ end
39
+
40
+ def retry_settings options = {}
41
+ interval = options[:sleep] || (test_mode ? 0 : 1)
42
+ {on: network_exceptions, tries: 3, interval: interval}.merge options
43
+ end
44
+
45
+ #override based on environment
46
+ def test_mode
47
+ false
48
+ end
49
+
50
+ class << self
51
+ delegate :retry_connection, to: NetworkRetry
52
+ end
53
+
54
+ extend self
55
+ end
56
+
57
+ end
data/lib/shutl_auth.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "rack/oauth2"
2
+ require "retriable/no_kernel"
3
+ require "shutl/network_retry"
4
+
5
+ require "shutl/auth/version"
6
+ require "shutl/auth/access_token_request"
7
+ require "shutl/auth/authenticated_request"
8
+
9
+ module Shutl
10
+ module Auth
11
+ extend self
12
+
13
+ attr_accessor :client_id, :client_secret, :url
14
+
15
+ def config
16
+ yield self
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'shutl/auth/version'
5
+ $platform ||= RUBY_PLATFORM[/java/] || 'ruby'
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "shutl_auth"
9
+ gem.version = Shutl::Auth::VERSION
10
+ gem.authors = ["Mark Burns"]
11
+ gem.email = ["markthedeveloper@gmail.com"]
12
+ gem.description = %q{Library used for using Shutl OAuth2 bearer tokens}
13
+ gem.summary = %q{Used by various gems/services for communicating with shutl oauth server}
14
+ gem.homepage = ""
15
+ gem.platform = $platform
16
+
17
+ gem.files = `git ls-files`.split($/)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.add_dependency 'retriable'
23
+ gem.add_dependency 'rack-oauth2'
24
+ gem.add_dependency 'crack', '~> 0.3.2'
25
+
26
+ gem.add_development_dependency 'rake'
27
+ gem.add_development_dependency 'rspec', '~> 2.11.0'
28
+ gem.add_development_dependency 'debugger' if $platform.to_s == 'ruby'
29
+ gem.add_development_dependency 'ruby-debug' if $platform.to_s == 'java'
30
+ gem.add_development_dependency 'webmock', '~> 1.8.7'
31
+ gem.add_development_dependency 'vcr'
32
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe Shutl::Auth do
4
+ subject { Shutl::Auth }
5
+
6
+ let(:oauth_client) { mock 'oauth client' }
7
+
8
+ before do
9
+ Rack::OAuth2::Client.stub(:new).and_return oauth_client
10
+
11
+ Shutl::Auth.config do |c|
12
+ c.url = "http://localhost:3000"
13
+ c.client_id = "QUOTE_SERVICE_CLIENT_ID"
14
+ c.client_secret = "QUOTE_SERVICE_CLIENT_SECRET"
15
+ end
16
+ end
17
+
18
+ context 'successful request to authentication service' do
19
+ before do
20
+ oauth_client.stub(:access_token!).and_return 'token response'
21
+ end
22
+
23
+ specify do
24
+ subject.access_token_response!.should == 'token response'
25
+ end
26
+ end
27
+
28
+ describe 'retries on network error' do
29
+ let(:oauth_client) do
30
+ FailNTimesThenSucceed.new number_of_failures, 'token'
31
+ end
32
+
33
+ context 'succeed on third attempt' do
34
+ let(:number_of_failures) { 2 }
35
+
36
+ specify do
37
+ Shutl::Auth.access_token_response!.should == 'token'
38
+ end
39
+ end
40
+
41
+ context 'fail more than two times' do
42
+ let(:number_of_failures) { 3 }
43
+
44
+ specify do
45
+ Shutl::Auth.access_token_response!.should be_nil
46
+ end
47
+ end
48
+
49
+ class FailNTimesThenSucceed
50
+ def initialize number_of_failures, access_token
51
+ @number_of_failures = number_of_failures
52
+ @access_token = access_token
53
+ @counter = 0
54
+ end
55
+
56
+ def access_token!
57
+ @counter += 1
58
+ raise Errno::ECONNREFUSED if @counter <= @number_of_failures
59
+ @access_token
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path('spec/spec_helper')
2
+
3
+ describe 'Config' do
4
+ Shutl::Auth.config do |s|
5
+ s.url = 'http://localhost:3001'
6
+ s.client_id = 'asdf'
7
+ s.client_secret = 'asdf'
8
+ end
9
+
10
+ it "has config for client_id and client_secret" do
11
+ Shutl::Auth.client_id = 'abc'
12
+ Shutl::Auth.client_secret = '123'
13
+ Shutl::Auth.url = 'http://localhost:3000'
14
+
15
+ Shutl::Auth.client_id. should == 'abc'
16
+ Shutl::Auth.client_secret.should == '123'
17
+ Shutl::Auth.url.should == 'http://localhost:3000'
18
+ end
19
+
20
+ it "has a nice config block" do
21
+ Shutl::Auth.config do |s|
22
+ s.url = 'asdf'
23
+ end
24
+
25
+ Shutl::Auth.url.should == 'asdf'
26
+ end
27
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe "Integration" do
5
+ subject { Shutl::Auth }
6
+
7
+ def set_auth
8
+ Shutl::Auth.config do |c|
9
+ c.url = "http://localhost:3000"
10
+ c.client_id = "QUOTE_SERVICE_CLIENT_ID"
11
+ c.client_secret = "QUOTE_SERVICE_CLIENT_SECRET"
12
+ end
13
+ end
14
+
15
+ before do
16
+ set_auth
17
+ end
18
+
19
+ context 'successful request to authentication service' do
20
+ let(:token) { 's_CagcDP8PdsGb1B0iyLvNtanSxqZeQDQtGiIYtctKzyLzxAymhe-zGJwUrjxKQpO9EUdizDT3tqLt-iFeHapg' }
21
+
22
+ specify do
23
+ VCR.use_cassette 'get_token' do
24
+ Shutl::Auth.access_token!.should == token
25
+ end
26
+ end
27
+
28
+ specify "with invalid auth service url" do
29
+ Shutl::Auth.url = ''
30
+
31
+ expect {Shutl::Auth.access_token!}.to raise_error Shutl::Auth::InvalidUrl
32
+
33
+ Shutl::Auth.url = 'http://'
34
+ expect {Shutl::Auth.access_token!}.to raise_error Shutl::Auth::InvalidUrl
35
+
36
+ Shutl::Auth.url = 'http://localhost:3000'
37
+
38
+ VCR.use_cassette 'get_token' do
39
+ Shutl::Auth.access_token!.should == token
40
+ end
41
+ end
42
+
43
+ specify "with 500 from auth server" do
44
+ set_auth
45
+
46
+ stub_request(:post, /.*#{Shutl::Auth.url}.*/).to_return(
47
+ { body: '',
48
+ status: 500,
49
+ headers: {"CONTENT_TYPE" => 'application/json'}}
50
+ )
51
+
52
+ Airbrake.should_receive(:notify)
53
+
54
+ expect{ Shutl::Auth.access_token!}.to raise_error Shutl::Auth::InternalServerError
55
+ end
56
+
57
+ specify "with invalid credentials" do
58
+ set_auth
59
+ Shutl::Auth.client_id = 'egg'
60
+
61
+ VCR.use_cassette 'invalid_credentials' do
62
+ expect { Shutl::Auth.access_token!}.to raise_error Shutl::Auth::InvalidCredentials
63
+ end
64
+
65
+ set_auth
66
+ Shutl::Auth.client_id = 'egg'
67
+
68
+ VCR.use_cassette 'invalid_credentials' do
69
+ expect { Shutl::Auth.access_token!}.to raise_error Shutl::Auth::InvalidCredentials
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,20 @@
1
+ require 'webmock/rspec'
2
+ require 'shutl_auth'
3
+ module Airbrake
4
+ def self.notify *args
5
+
6
+ end
7
+ end
8
+
9
+ require 'vcr'
10
+
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = 'spec/vcr'
13
+ c.hook_into :webmock
14
+ c.allow_http_connections_when_no_cassette = false
15
+ c.default_cassette_options = {
16
+ record: ENV['VCR_RERECORD'].present? ? :all : :once
17
+ }
18
+ end
19
+
20
+
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3000/token
6
+ body:
7
+ encoding: ASCII-8BIT
8
+ string: !binary |-
9
+ Z3JhbnRfdHlwZT1jbGllbnRfY3JlZGVudGlhbHM=
10
+ headers:
11
+ Authorization:
12
+ - Basic UVVPVEVfU0VSVklDRV9DTElFTlRfSUQ6UVVPVEVfU0VSVklDRV9DTElFTlRfU0VDUkVU
13
+ Content-Type:
14
+ - application/x-www-form-urlencoded
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: !binary |-
19
+ T0sg
20
+ headers:
21
+ !binary "Q29udGVudC1UeXBl":
22
+ - !binary |-
23
+ YXBwbGljYXRpb24vanNvbg==
24
+ !binary "Q29udGVudC1MZW5ndGg=":
25
+ - !binary |-
26
+ MTUw
27
+ !binary "Q2FjaGUtQ29udHJvbA==":
28
+ - !binary |-
29
+ bm8tc3RvcmU=
30
+ !binary "UHJhZ21h":
31
+ - !binary |-
32
+ bm8tY2FjaGU=
33
+ !binary "WC1VYS1Db21wYXRpYmxl":
34
+ - !binary |-
35
+ SUU9RWRnZQ==
36
+ !binary "RXRhZw==":
37
+ - !binary |-
38
+ IjkzNmFlZDkyMzFjODkxMzE3YzMwNzQwMjUyNTBmZDczIg==
39
+ !binary "WC1SZXF1ZXN0LUlk":
40
+ - !binary |-
41
+ ZDRhMWViZWZlMWUzMzgyNjAyNjFlMDNkNzcyNmUwYWI=
42
+ !binary "WC1SdW50aW1l":
43
+ - !binary |-
44
+ MC4wMTQyMzE=
45
+ !binary "U2VydmVy":
46
+ - !binary |-
47
+ V0VCcmljay8xLjMuMSAoUnVieS8xLjkuMy8yMDEyLTAyLTE2KQ==
48
+ !binary "RGF0ZQ==":
49
+ - !binary |-
50
+ VHVlLCAwMSBKYW4gMjAxMyAwNDoxNjowMCBHTVQ=
51
+ !binary "Q29ubmVjdGlvbg==":
52
+ - !binary |-
53
+ S2VlcC1BbGl2ZQ==
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ! '{"access_token":"s_CagcDP8PdsGb1B0iyLvNtanSxqZeQDQtGiIYtctKzyLzxAymhe-zGJwUrjxKQpO9EUdizDT3tqLt-iFeHapg","token_type":"bearer","expires_in":788939999}'
57
+ http_version:
58
+ recorded_at: Tue, 01 Jan 2013 04:16:00 GMT
59
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3000/token
6
+ body:
7
+ encoding: ASCII-8BIT
8
+ string: !binary |-
9
+ Z3JhbnRfdHlwZT1jbGllbnRfY3JlZGVudGlhbHM=
10
+ headers:
11
+ Authorization:
12
+ - Basic ZWdnOlFVT1RFX1NFUlZJQ0VfQ0xJRU5UX1NFQ1JFVA==
13
+ Content-Type:
14
+ - application/x-www-form-urlencoded
15
+ response:
16
+ status:
17
+ code: 401
18
+ message: !binary |-
19
+ VW5hdXRob3JpemVkIA==
20
+ headers:
21
+ !binary "Q29udGVudC1UeXBl":
22
+ - !binary |-
23
+ YXBwbGljYXRpb24vanNvbg==
24
+ !binary "V3d3LUF1dGhlbnRpY2F0ZQ==":
25
+ - !binary |-
26
+ QmFzaWMgcmVhbG09Ik9BdXRoMiBUb2tlbiBFbmRwb2ludCI=
27
+ !binary "Q29udGVudC1MZW5ndGg=":
28
+ - !binary |-
29
+ MjQ2
30
+ !binary "WC1VYS1Db21wYXRpYmxl":
31
+ - !binary |-
32
+ SUU9RWRnZQ==
33
+ !binary "Q2FjaGUtQ29udHJvbA==":
34
+ - !binary |-
35
+ bm8tY2FjaGU=
36
+ !binary "WC1SZXF1ZXN0LUlk":
37
+ - !binary |-
38
+ ZWE4N2IzOTA4ZjM0YThlZDNiNWM4NzYxYjZkZGZiOGM=
39
+ !binary "WC1SdW50aW1l":
40
+ - !binary |-
41
+ MC4wMDk1NDQ=
42
+ !binary "U2VydmVy":
43
+ - !binary |-
44
+ V0VCcmljay8xLjMuMSAoUnVieS8xLjkuMy8yMDEyLTAyLTE2KQ==
45
+ !binary "RGF0ZQ==":
46
+ - !binary |-
47
+ VHVlLCAwMSBKYW4gMjAxMyAwNDozMzozMiBHTVQ=
48
+ !binary "Q29ubmVjdGlvbg==":
49
+ - !binary |-
50
+ S2VlcC1BbGl2ZQ==
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"error":"invalid_client","error_description":"The client identifier
54
+ provided is invalid, the client failed to authenticate, the client did not
55
+ include its credentials, provided multiple client credentials, or used unsupported
56
+ credentials type."}'
57
+ http_version:
58
+ recorded_at: Tue, 01 Jan 2013 04:33:32 GMT
59
+ recorded_with: VCR 2.3.0
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shutl_auth
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.8.0
6
+ platform: ruby
7
+ authors:
8
+ - Mark Burns
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ type: :runtime
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ name: retriable
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ type: :runtime
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ name: rack-oauth2
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ type: :runtime
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.3.2
54
+ name: crack
55
+ prerelease: false
56
+ requirement: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.3.2
62
+ - !ruby/object:Gem::Dependency
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ name: rake
71
+ prerelease: false
72
+ requirement: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ type: :development
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.11.0
86
+ name: rspec
87
+ prerelease: false
88
+ requirement: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.11.0
94
+ - !ruby/object:Gem::Dependency
95
+ type: :development
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ name: debugger
103
+ prerelease: false
104
+ requirement: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ type: :development
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.8.7
118
+ name: webmock
119
+ prerelease: false
120
+ requirement: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.8.7
126
+ - !ruby/object:Gem::Dependency
127
+ type: :development
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ name: vcr
135
+ prerelease: false
136
+ requirement: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ description: Library used for using Shutl OAuth2 bearer tokens
143
+ email:
144
+ - markthedeveloper@gmail.com
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - .rbenv-version
151
+ - .rvmrc
152
+ - .travis.yml
153
+ - Gemfile
154
+ - LICENSE.txt
155
+ - README.md
156
+ - Rakefile
157
+ - lib/shutl/auth/access_token_request.rb
158
+ - lib/shutl/auth/authenticated_request.rb
159
+ - lib/shutl/auth/version.rb
160
+ - lib/shutl/network_retry.rb
161
+ - lib/shutl_auth.rb
162
+ - shutl_auth.gemspec
163
+ - spec/access_token_request_spec.rb
164
+ - spec/config_spec.rb
165
+ - spec/integration/integration_spec.rb
166
+ - spec/spec_helper.rb
167
+ - spec/vcr/get_token.yml
168
+ - spec/vcr/invalid_credentials.yml
169
+ homepage: ''
170
+ licenses: []
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ segments:
181
+ - 0
182
+ hash: -4126692447014945650
183
+ version: '0'
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ segments:
190
+ - 0
191
+ hash: -4126692447014945650
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 1.8.23
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: Used by various gems/services for communicating with shutl oauth server
199
+ test_files:
200
+ - spec/access_token_request_spec.rb
201
+ - spec/config_spec.rb
202
+ - spec/integration/integration_spec.rb
203
+ - spec/spec_helper.rb
204
+ - spec/vcr/get_token.yml
205
+ - spec/vcr/invalid_credentials.yml