oa-core 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -0,0 +1,3 @@
1
+ == 0.0.3
2
+
3
+ * Added OmniAuth::Form for displaying info forms on systems that will require them.
@@ -1,3 +1,5 @@
1
+ require 'omniauth/core'
2
+
1
3
  module OmniAuth
2
4
  class Builder < Rack::Builder
3
5
  def initialize(app, &block)
data/lib/omniauth/core.rb CHANGED
@@ -1,9 +1,17 @@
1
1
  require 'rack'
2
2
  require 'singleton'
3
-
4
3
  require 'omniauth/form'
5
4
 
6
5
  module OmniAuth
6
+
7
+ autoload :Builder, 'omniauth/builder'
8
+ autoload :Strategy, 'omniauth/strategy'
9
+ autoload :Test, 'omniauth/test'
10
+
11
+ module Strategies
12
+ autoload :Password, 'omniauth/strategies/password'
13
+ end
14
+
7
15
  class Configuration
8
16
  include Singleton
9
17
 
@@ -85,6 +93,3 @@ module OmniAuth
85
93
  end
86
94
  end
87
95
  end
88
-
89
- require 'omniauth/builder'
90
- require 'omniauth/strategy'
data/lib/omniauth/form.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'omniauth/core'
2
+
1
3
  module OmniAuth
2
4
  class Form
3
5
  DEFAULT_CSS = <<-CSS
@@ -58,6 +60,12 @@ module OmniAuth
58
60
  width: 280px;
59
61
  }
60
62
 
63
+ input#identifier, input#openid_url {
64
+ background: url(http://openid.net/login-bg.gif) no-repeat;
65
+ background-position: 0 50%;
66
+ padding-left: 18px;
67
+ }
68
+
61
69
  button {
62
70
  font-size: 22px;
63
71
  padding: 4px 8px;
@@ -1,4 +1,6 @@
1
1
  require 'digest/sha1'
2
+ require 'omniauth/core'
3
+
2
4
  module OmniAuth
3
5
  module Strategies
4
6
  class Password
@@ -6,7 +8,6 @@ module OmniAuth
6
8
 
7
9
  def initialize(app, secret = 'changethisappsecret', options = {})
8
10
  @options = options
9
- @options[:identifier_key] ||= 'nickname'
10
11
  @secret = secret
11
12
  super(app, :password)
12
13
  end
@@ -16,7 +17,6 @@ module OmniAuth
16
17
  def request_phase
17
18
  return fail!(:missing_information) unless request[:identifier] && request[:password]
18
19
  return fail!(:password_mismatch) if request[:password_confirmation] && request[:password_confirmation] != '' && request[:password] != request[:password_confirmation]
19
-
20
20
  env['REQUEST_METHOD'] = 'GET'
21
21
  env['PATH_INFO'] = request.path + '/callback'
22
22
  request['auth'] = auth_hash(encrypt(request[:identifier], request[:password]))
@@ -1,5 +1,9 @@
1
+ require 'omniauth/core'
2
+
1
3
  module OmniAuth
4
+
2
5
  module Strategy
6
+
3
7
  def self.included(base)
4
8
  base.class_eval do
5
9
  attr_reader :app, :name, :env
@@ -0,0 +1,12 @@
1
+ module OmniAuth
2
+
3
+ # Support for testing OmniAuth strategies.
4
+ module Test
5
+
6
+ autoload :PhonySession, 'omniauth/test/phony_session'
7
+ autoload :StrategyMacros, 'omniauth/test/strategy_macros'
8
+ autoload :StrategyTestCase, 'omniauth/test/strategy_test_case'
9
+
10
+ end
11
+
12
+ end
@@ -0,0 +1,8 @@
1
+ class OmniAuth::Test::PhonySession
2
+ def initialize(app); @app = app end
3
+ def call(env)
4
+ @session ||= (env['rack.session'] || {})
5
+ env['rack.session'] = @session
6
+ @app.call(env)
7
+ end
8
+ end
@@ -0,0 +1,29 @@
1
+ module OmniAuth
2
+
3
+ module Test
4
+
5
+ module StrategyMacros
6
+
7
+ def sets_an_auth_hash
8
+ it 'should set an auth hash' do
9
+ last_request['auth'].should be_kind_of(Hash)
10
+ end
11
+ end
12
+
13
+ def sets_provider_to(provider)
14
+ it "should set the provider to #{provider}" do
15
+ (last_request['auth'] || {})['provider'].should == provider
16
+ end
17
+ end
18
+
19
+ def sets_uid_to(uid)
20
+ it "should set the UID to #{uid}" do
21
+ (last_request['auth'] || {})['uid'].should == uid
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,43 @@
1
+ require 'rack'
2
+ require 'omniauth/test'
3
+
4
+ module OmniAuth
5
+
6
+ module Test
7
+
8
+ # Support for testing OmniAuth strategies. Usage:
9
+ #
10
+ # class MyStrategyTest < Test::Unit::TestCase
11
+ # include OmniAuth::Test::StrategyTestCase
12
+ # def strategy
13
+ # # return the parameters to a Rack::Builder map call:
14
+ # [MyStrategy.new, :some, :configuration, :options => 'here']
15
+ # end
16
+ # setup do
17
+ # post '/auth/my_strategy/callback', :user => { 'name' => 'Dylan', 'id' => '445' }
18
+ # end
19
+ # end
20
+ module StrategyTestCase
21
+
22
+ def app
23
+ strategy = self.strategy
24
+ Rack::Builder.new {
25
+ use OmniAuth::Test::PhonySession
26
+ use *strategy
27
+ run lambda { |env| [200, {'Content-Type' => 'text/plain'}, [Rack::Request.new(env).params.key?('auth').to_s]] }
28
+ }.to_app
29
+ end
30
+
31
+ def session
32
+ last_request.env['rack.session']
33
+ end
34
+
35
+ def strategy
36
+ raise NotImplementedError.new('Including specs must define #strategy')
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-core
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Bleigh
@@ -14,71 +15,118 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-01 00:00:00 -04:00
18
+ date: 2010-08-16 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 13
28
+ segments:
29
+ - 1
30
+ - 1
31
+ version: "1.1"
32
+ requirement: *id001
21
33
  name: rack
22
34
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
35
+ type: :runtime
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
24
39
  requirements:
25
40
  - - ">="
26
41
  - !ruby/object:Gem::Version
42
+ hash: 3
27
43
  segments:
28
44
  - 0
29
45
  version: "0"
30
- type: :runtime
31
- version_requirements: *id001
32
- - !ruby/object:Gem::Dependency
33
- name: rspec
46
+ requirement: *id002
47
+ name: rake
34
48
  prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
49
+ type: :development
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
36
53
  requirements:
37
- - - ">="
54
+ - - ~>
38
55
  - !ruby/object:Gem::Version
56
+ hash: 15
39
57
  segments:
40
- - 1
41
- - 2
42
- - 9
43
- version: 1.2.9
58
+ - 0
59
+ - 0
60
+ - 8
61
+ version: 0.0.8
62
+ requirement: *id003
63
+ name: mg
64
+ prerelease: false
44
65
  type: :development
45
- version_requirements: *id002
46
66
  - !ruby/object:Gem::Dependency
47
- name: webmock
48
- prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
50
69
  requirements:
51
- - - ">="
70
+ - - ~>
52
71
  - !ruby/object:Gem::Version
72
+ hash: 27
53
73
  segments:
74
+ - 1
75
+ - 3
54
76
  - 0
55
- version: "0"
77
+ version: 1.3.0
78
+ requirement: *id004
79
+ name: rspec
80
+ prerelease: false
56
81
  type: :development
57
- version_requirements: *id003
58
82
  - !ruby/object:Gem::Dependency
59
- name: rack-test
83
+ version_requirements: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ hash: 19
89
+ segments:
90
+ - 1
91
+ - 3
92
+ - 4
93
+ version: 1.3.4
94
+ requirement: *id005
95
+ name: webmock
60
96
  prerelease: false
61
- requirement: &id004 !ruby/object:Gem::Requirement
97
+ type: :development
98
+ - !ruby/object:Gem::Dependency
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ none: false
62
101
  requirements:
63
- - - ">="
102
+ - - ~>
64
103
  - !ruby/object:Gem::Version
104
+ hash: 3
65
105
  segments:
66
106
  - 0
67
- version: "0"
107
+ - 5
108
+ - 4
109
+ version: 0.5.4
110
+ requirement: *id006
111
+ name: rack-test
112
+ prerelease: false
68
113
  type: :development
69
- version_requirements: *id004
70
114
  - !ruby/object:Gem::Dependency
71
- name: mg
72
- prerelease: false
73
- requirement: &id005 !ruby/object:Gem::Requirement
115
+ version_requirements: &id007 !ruby/object:Gem::Requirement
116
+ none: false
74
117
  requirements:
75
- - - ">="
118
+ - - ~>
76
119
  - !ruby/object:Gem::Version
120
+ hash: 1
77
121
  segments:
78
- - 0
79
- version: "0"
122
+ - 1
123
+ - 4
124
+ - 3
125
+ version: 1.4.3
126
+ requirement: *id007
127
+ name: json
128
+ prerelease: false
80
129
  type: :development
81
- version_requirements: *id005
82
130
  description: HTTP Basic strategies for OmniAuth.
83
131
  email: michael@intridea.com
84
132
  executables: []
@@ -91,10 +139,12 @@ files:
91
139
  - lib/omniauth/builder.rb
92
140
  - lib/omniauth/core.rb
93
141
  - lib/omniauth/form.rb
94
- - lib/omniauth/password.rb
95
142
  - lib/omniauth/strategies/password.rb
96
143
  - lib/omniauth/strategy.rb
97
- - README.rdoc
144
+ - lib/omniauth/test/phony_session.rb
145
+ - lib/omniauth/test/strategy_macros.rb
146
+ - lib/omniauth/test/strategy_test_case.rb
147
+ - lib/omniauth/test.rb
98
148
  - LICENSE.rdoc
99
149
  - CHANGELOG.rdoc
100
150
  has_rdoc: true
@@ -107,23 +157,27 @@ rdoc_options: []
107
157
  require_paths:
108
158
  - lib
109
159
  required_ruby_version: !ruby/object:Gem::Requirement
160
+ none: false
110
161
  requirements:
111
162
  - - ">="
112
163
  - !ruby/object:Gem::Version
164
+ hash: 3
113
165
  segments:
114
166
  - 0
115
167
  version: "0"
116
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
+ none: false
117
170
  requirements:
118
171
  - - ">="
119
172
  - !ruby/object:Gem::Version
173
+ hash: 3
120
174
  segments:
121
175
  - 0
122
176
  version: "0"
123
177
  requirements: []
124
178
 
125
179
  rubyforge_project:
126
- rubygems_version: 1.3.6
180
+ rubygems_version: 1.3.7
127
181
  signing_key:
128
182
  specification_version: 3
129
183
  summary: HTTP Basic strategies for OmniAuth.
data/README.rdoc DELETED
File without changes
@@ -1,2 +0,0 @@
1
- require 'omniauth/core'
2
- require 'omniauth/strategies/password'