oa-core 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/omniauth/builder.rb
CHANGED
@@ -7,6 +7,14 @@ module OmniAuth
|
|
7
7
|
super(&block)
|
8
8
|
end
|
9
9
|
|
10
|
+
def on_failure(&block)
|
11
|
+
OmniAuth.config.on_failure = block
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(&block)
|
15
|
+
OmniAuth.configure(&block)
|
16
|
+
end
|
17
|
+
|
10
18
|
def provider(klass, *args, &block)
|
11
19
|
if klass.is_a?(Class)
|
12
20
|
middleware = klass
|
@@ -19,8 +19,8 @@ module OmniAuth
|
|
19
19
|
return fail!(:password_mismatch) if request[:password_confirmation] && request[:password_confirmation] != '' && request[:password] != request[:password_confirmation]
|
20
20
|
env['REQUEST_METHOD'] = 'GET'
|
21
21
|
env['PATH_INFO'] = request.path + '/callback'
|
22
|
-
env['
|
23
|
-
|
22
|
+
env['omniauth.auth'] = auth_hash(encrypt(request[:identifier], request[:password]))
|
23
|
+
call_app!
|
24
24
|
end
|
25
25
|
|
26
26
|
def auth_hash(crypted_password)
|
@@ -33,7 +33,7 @@ module OmniAuth
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def callback_phase
|
36
|
-
|
36
|
+
call_app!
|
37
37
|
end
|
38
38
|
|
39
39
|
def encrypt(identifier, password)
|
data/lib/omniauth/strategy.rb
CHANGED
@@ -29,7 +29,7 @@ module OmniAuth
|
|
29
29
|
if respond_to?(:other_phase)
|
30
30
|
other_phase
|
31
31
|
else
|
32
|
-
|
32
|
+
call_app!
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -39,8 +39,15 @@ module OmniAuth
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def callback_phase
|
42
|
-
env['
|
43
|
-
|
42
|
+
@env['omniauth.auth'] = auth_hash
|
43
|
+
call_app!
|
44
|
+
end
|
45
|
+
|
46
|
+
def call_app!
|
47
|
+
@env['rack.auth'] = env['omniauth.auth'] if env.key?('omniauth.auth')
|
48
|
+
@env['rack.auth.error'] = env['omniauth.error'] if env.key?('omniauth.error')
|
49
|
+
|
50
|
+
@app.call(@env)
|
44
51
|
end
|
45
52
|
|
46
53
|
def auth_hash
|
@@ -77,7 +84,8 @@ module OmniAuth
|
|
77
84
|
|
78
85
|
def user_info; {} end
|
79
86
|
|
80
|
-
def fail!(message_key)
|
87
|
+
def fail!(message_key, exception = nil)
|
88
|
+
self.env['omniauth.error'] = exception
|
81
89
|
OmniAuth.config.on_failure.call(self.env, message_key.to_sym)
|
82
90
|
end
|
83
91
|
end
|
@@ -6,19 +6,19 @@ module OmniAuth
|
|
6
6
|
|
7
7
|
def sets_an_auth_hash
|
8
8
|
it 'should set an auth hash' do
|
9
|
-
last_request.env['
|
9
|
+
last_request.env['omniauth.auth'].should be_kind_of(Hash)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def sets_provider_to(provider)
|
14
14
|
it "should set the provider to #{provider}" do
|
15
|
-
(last_request.env['
|
15
|
+
(last_request.env['omniauth.auth'] || {})['provider'].should == provider
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def sets_uid_to(uid)
|
20
20
|
it "should set the UID to #{uid}" do
|
21
|
-
(last_request.env['
|
21
|
+
(last_request.env['omniauth.auth'] || {})['uid'].should == uid
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Bleigh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|