oa-basic 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,15 +5,15 @@ module OmniAuth
5
5
  module Strategies
6
6
  class HttpBasic
7
7
  include OmniAuth::Strategy
8
-
8
+
9
9
  def initialize(app, name, endpoint = nil, headers = {}, &block)
10
10
  super
11
11
  @endpoint = endpoint
12
12
  @request_headers = headers
13
13
  end
14
-
14
+
15
15
  attr_reader :endpoint, :request_headers
16
-
16
+
17
17
  def request_phase
18
18
  if env['REQUEST_METHOD'] == 'GET'
19
19
  get_credentials
@@ -21,33 +21,33 @@ module OmniAuth
21
21
  perform
22
22
  end
23
23
  end
24
-
24
+
25
25
  def title
26
26
  name.split('_').map{|s| s.capitalize}.join(' ')
27
27
  end
28
-
28
+
29
29
  def get_credentials
30
30
  OmniAuth::Form.build(:title => title) do
31
31
  text_field 'Username', 'username'
32
32
  password_field 'Password', 'password'
33
33
  end.to_response
34
34
  end
35
-
35
+
36
36
  def perform
37
37
  @response = perform_authentication(endpoint)
38
38
  @env['omniauth.auth'] = auth_hash
39
39
  @env['REQUEST_METHOD'] = 'GET'
40
40
  @env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback"
41
-
41
+
42
42
  call_app!
43
43
  rescue RestClient::Request::Unauthorized => e
44
44
  fail!(:invalid_credentials, e)
45
45
  end
46
-
46
+
47
47
  def perform_authentication(uri, headers = request_headers)
48
48
  RestClient.get(uri, headers)
49
49
  end
50
-
50
+
51
51
  def callback_phase
52
52
  fail!(:invalid_credentials)
53
53
  end
@@ -0,0 +1,19 @@
1
+ module OmniAuth
2
+ module Version
3
+ unless defined?(::OmniAuth::Version::MAJOR)
4
+ MAJOR = 0
5
+ end
6
+ unless defined?(::OmniAuth::Version::MINOR)
7
+ MINOR = 2
8
+ end
9
+ unless defined?(::OmniAuth::Version::PATCH)
10
+ PATCH = 5
11
+ end
12
+ unless defined?(::OmniAuth::Version::PRE)
13
+ PRE = nil
14
+ end
15
+ unless defined?(::OmniAuth::Version::STRING)
16
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
17
+ end
18
+ end
19
+ end
@@ -1,19 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../../omniauth/lib/omniauth/version', __FILE__)
2
+ require File.expand_path('../lib/omniauth/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.add_runtime_dependency 'oa-core', Omniauth::VERSION.dup
5
+ gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
6
+ gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
6
7
  gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
8
+ gem.add_development_dependency 'maruku', '~> 0.6'
7
9
  gem.add_development_dependency 'simplecov', '~> 0.4'
8
10
  gem.add_development_dependency 'rack-test', '~> 0.5'
9
11
  gem.add_development_dependency 'rake', '~> 0.8'
10
12
  gem.add_development_dependency 'rspec', '~> 2.5'
11
13
  gem.add_development_dependency 'webmock', '~> 1.6'
12
14
  gem.add_development_dependency 'yard', '~> 0.6'
15
+ gem.add_development_dependency 'ZenTest', '~> 4.5'
13
16
  gem.name = 'oa-basic'
14
- gem.version = Omniauth::VERSION.dup
15
- gem.summary = %q{HTTP Basic strategies for OmniAuth.}
17
+ gem.version = OmniAuth::Version::STRING
16
18
  gem.description = %q{HTTP Basic strategies for OmniAuth.}
19
+ gem.summary = gem.description
17
20
  gem.email = ['michael@intridea.com', 'sferik@gmail.com']
18
21
  gem.homepage = 'http://github.com/intridea/omniauth'
19
22
  gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
2
 
3
3
  describe OmniAuth::Strategies::HttpBasic do
4
4
  it 'should exist' do
@@ -1,12 +1,11 @@
1
- require 'rubygems'
1
+ require 'simplecov'
2
+ SimpleCov.start
2
3
  require 'rspec'
3
- require 'rspec/autorun'
4
4
  require 'rack/test'
5
5
  require 'webmock/rspec'
6
-
7
- include Rack::Test::Methods
8
- include WebMock::API
9
-
10
6
  require 'omniauth/basic'
11
7
 
12
- WebMock.disable_net_connect!
8
+ RSpec.configure do |config|
9
+ config.include Rack::Test::Methods
10
+ config.include WebMock::API
11
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: oa-basic
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.4
5
+ version: 0.2.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Bleigh
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-04-22 00:00:00 Z
14
+ date: 2011-04-29 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: oa-core
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - "="
23
23
  - !ruby/object:Gem::Version
24
- version: 0.2.4
24
+ version: 0.2.5
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -36,71 +36,93 @@ dependencies:
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: simplecov
39
+ name: maruku
40
40
  prerelease: false
41
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: "0.4"
46
+ version: "0.6"
47
47
  type: :development
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
- name: rack-test
50
+ name: simplecov
51
51
  prerelease: false
52
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- version: "0.5"
57
+ version: "0.4"
58
58
  type: :development
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
61
- name: rake
61
+ name: rack-test
62
62
  prerelease: false
63
63
  requirement: &id005 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: "0.8"
68
+ version: "0.5"
69
69
  type: :development
70
70
  version_requirements: *id005
71
71
  - !ruby/object:Gem::Dependency
72
- name: rspec
72
+ name: rake
73
73
  prerelease: false
74
74
  requirement: &id006 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- version: "2.5"
79
+ version: "0.8"
80
80
  type: :development
81
81
  version_requirements: *id006
82
82
  - !ruby/object:Gem::Dependency
83
- name: webmock
83
+ name: rspec
84
84
  prerelease: false
85
85
  requirement: &id007 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: "1.6"
90
+ version: "2.5"
91
91
  type: :development
92
92
  version_requirements: *id007
93
93
  - !ruby/object:Gem::Dependency
94
- name: yard
94
+ name: webmock
95
95
  prerelease: false
96
96
  requirement: &id008 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: "0.6"
101
+ version: "1.6"
102
102
  type: :development
103
103
  version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: yard
106
+ prerelease: false
107
+ requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ~>
111
+ - !ruby/object:Gem::Version
112
+ version: "0.6"
113
+ type: :development
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
116
+ name: ZenTest
117
+ prerelease: false
118
+ requirement: &id010 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: "4.5"
124
+ type: :development
125
+ version_requirements: *id010
104
126
  description: HTTP Basic strategies for OmniAuth.
105
127
  email:
106
128
  - michael@intridea.com
@@ -115,13 +137,13 @@ files:
115
137
  - .gemtest
116
138
  - .rspec
117
139
  - .yardopts
118
- - Gemfile
119
140
  - LICENSE
120
141
  - README.rdoc
121
142
  - Rakefile
122
143
  - lib/oa-basic.rb
123
144
  - lib/omniauth/basic.rb
124
145
  - lib/omniauth/strategies/http_basic.rb
146
+ - lib/omniauth/version.rb
125
147
  - oa-basic.gemspec
126
148
  - spec/omniauth/strategies/basic_spec.rb
127
149
  - spec/spec_helper.rb
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec