oa-core 0.2.0.beta2 → 0.2.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/omniauth/core.rb +2 -1
- data/lib/omniauth/strategies/password.rb +1 -2
- data/lib/omniauth/strategy.rb +11 -5
- data/lib/omniauth/test/strategy_macros.rb +5 -0
- metadata +5 -39
data/lib/omniauth/core.rb
CHANGED
@@ -26,6 +26,7 @@ module OmniAuth
|
|
26
26
|
end,
|
27
27
|
:form_css => Form::DEFAULT_CSS,
|
28
28
|
:test_mode => false,
|
29
|
+
:allowed_request_methods => [:get, :post],
|
29
30
|
:mock_auth => {
|
30
31
|
:default => {
|
31
32
|
'uid' => '1234',
|
@@ -55,7 +56,7 @@ module OmniAuth
|
|
55
56
|
end
|
56
57
|
|
57
58
|
attr_writer :on_failure
|
58
|
-
attr_accessor :path_prefix, :form_css, :test_mode, :mock_auth, :full_host
|
59
|
+
attr_accessor :path_prefix, :allowed_request_methods, :form_css, :test_mode, :mock_auth, :full_host
|
59
60
|
end
|
60
61
|
|
61
62
|
def self.config
|
@@ -7,9 +7,8 @@ module OmniAuth
|
|
7
7
|
include OmniAuth::Strategy
|
8
8
|
|
9
9
|
def initialize(app, secret = 'changethisappsecret', options = {}, &block)
|
10
|
-
@options = options
|
11
10
|
@secret = secret
|
12
|
-
super(app, :password, &block)
|
11
|
+
super(app, :password, options, &block)
|
13
12
|
end
|
14
13
|
|
15
14
|
attr_reader :secret
|
data/lib/omniauth/strategy.rb
CHANGED
@@ -26,12 +26,12 @@ module OmniAuth
|
|
26
26
|
def call!(env)
|
27
27
|
@env = env
|
28
28
|
return mock_call!(env) if OmniAuth.config.test_mode
|
29
|
-
|
30
|
-
if
|
29
|
+
|
30
|
+
if current_path == request_path && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
|
31
31
|
status, headers, body = *call_app!
|
32
32
|
@response = Rack::Response.new(body, status, headers)
|
33
33
|
request_phase
|
34
|
-
elsif
|
34
|
+
elsif current_path == callback_path
|
35
35
|
callback_phase
|
36
36
|
else
|
37
37
|
if respond_to?(:other_phase)
|
@@ -43,9 +43,11 @@ module OmniAuth
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def mock_call!(env)
|
46
|
-
if
|
46
|
+
if current_path == request_path
|
47
|
+
status, headers, body = *call_app!
|
48
|
+
@response = Rack::Response.new(body, status, headers)
|
47
49
|
redirect callback_path
|
48
|
-
elsif
|
50
|
+
elsif current_path == callback_path
|
49
51
|
@env['omniauth.auth'] = OmniAuth.mock_auth_for(name.to_sym)
|
50
52
|
call_app!
|
51
53
|
else
|
@@ -75,6 +77,10 @@ module OmniAuth
|
|
75
77
|
options[:callback_path] || "#{path_prefix}/#{name}/callback"
|
76
78
|
end
|
77
79
|
|
80
|
+
def current_path
|
81
|
+
request.path.sub(/\/$/,'')
|
82
|
+
end
|
83
|
+
|
78
84
|
def query_string
|
79
85
|
request.query_string.empty? ? "" : "?#{request.query_string}"
|
80
86
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- beta2
|
10
|
-
version: 0.2.0.beta2
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.2.0.beta3
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Michael Bleigh
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-02-03 00:00:00 -06:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,9 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 1
|
31
23
|
version: "1.1"
|
32
24
|
type: :runtime
|
33
25
|
prerelease: false
|
@@ -39,8 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ">="
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 0
|
44
34
|
version: "0"
|
45
35
|
type: :development
|
46
36
|
prerelease: false
|
@@ -52,10 +42,6 @@ dependencies:
|
|
52
42
|
requirements:
|
53
43
|
- - ~>
|
54
44
|
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 0
|
57
|
-
- 0
|
58
|
-
- 8
|
59
45
|
version: 0.0.8
|
60
46
|
type: :development
|
61
47
|
prerelease: false
|
@@ -67,10 +53,6 @@ dependencies:
|
|
67
53
|
requirements:
|
68
54
|
- - ~>
|
69
55
|
- !ruby/object:Gem::Version
|
70
|
-
segments:
|
71
|
-
- 1
|
72
|
-
- 3
|
73
|
-
- 0
|
74
56
|
version: 1.3.0
|
75
57
|
type: :development
|
76
58
|
prerelease: false
|
@@ -82,10 +64,6 @@ dependencies:
|
|
82
64
|
requirements:
|
83
65
|
- - ~>
|
84
66
|
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 1
|
87
|
-
- 3
|
88
|
-
- 4
|
89
67
|
version: 1.3.4
|
90
68
|
type: :development
|
91
69
|
prerelease: false
|
@@ -97,10 +75,6 @@ dependencies:
|
|
97
75
|
requirements:
|
98
76
|
- - ~>
|
99
77
|
- !ruby/object:Gem::Version
|
100
|
-
segments:
|
101
|
-
- 0
|
102
|
-
- 5
|
103
|
-
- 4
|
104
78
|
version: 0.5.4
|
105
79
|
type: :development
|
106
80
|
prerelease: false
|
@@ -112,10 +86,6 @@ dependencies:
|
|
112
86
|
requirements:
|
113
87
|
- - ~>
|
114
88
|
- !ruby/object:Gem::Version
|
115
|
-
segments:
|
116
|
-
- 1
|
117
|
-
- 4
|
118
|
-
- 3
|
119
89
|
version: 1.4.3
|
120
90
|
type: :development
|
121
91
|
prerelease: false
|
@@ -153,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
123
|
requirements:
|
154
124
|
- - ">="
|
155
125
|
- !ruby/object:Gem::Version
|
156
|
-
hash: -
|
126
|
+
hash: -4575558600340992300
|
157
127
|
segments:
|
158
128
|
- 0
|
159
129
|
version: "0"
|
@@ -162,15 +132,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
132
|
requirements:
|
163
133
|
- - ">"
|
164
134
|
- !ruby/object:Gem::Version
|
165
|
-
segments:
|
166
|
-
- 1
|
167
|
-
- 3
|
168
|
-
- 1
|
169
135
|
version: 1.3.1
|
170
136
|
requirements: []
|
171
137
|
|
172
138
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.5.0
|
174
140
|
signing_key:
|
175
141
|
specification_version: 3
|
176
142
|
summary: HTTP Basic strategies for OmniAuth.
|