simple_admin_auth 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile.lock +22 -17
- data/README.md +8 -0
- data/config.ru +10 -1
- data/gemfiles/rack1.5.gemfile.lock +7 -4
- data/gemfiles/rack1.6.gemfile.lock +7 -4
- data/gemfiles/rails3.2.gemfile.lock +8 -5
- data/gemfiles/rails4.0.gemfile.lock +7 -4
- data/gemfiles/rails4.1.gemfile.lock +8 -5
- data/gemfiles/rails4.2.gemfile.lock +8 -5
- data/lib/simple_admin_auth/application.rb +14 -0
- data/lib/simple_admin_auth/configuration.rb +3 -1
- data/lib/simple_admin_auth/version.rb +1 -1
- data/spec/integration_examples.rb +67 -1
- data/spec/spec_helper.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27de75f737bbab956042d1c494449358ceb7413d
|
4
|
+
data.tar.gz: 52449b62c941c6f16da25cc1ff712f5e3ee71cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee6fa8c38fd6ff7f2463d78c3c23b8b0d78e80d081dc505033d6c61702121c5b46483d64d8b4806b1700758e9c3023ae103d324a016015d285182ccef593e75
|
7
|
+
data.tar.gz: 1253441ecae56dc2152ebf566bf4eb5ef185e0fff1ccfa02a15c167f8acd8ce65063fe54a3badac53ca566e31eeaa3d77c186c25120579c7f64d1e52d0908f5f
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -43,21 +43,22 @@ GEM
|
|
43
43
|
minitest (~> 5.1)
|
44
44
|
thread_safe (~> 0.3, >= 0.3.4)
|
45
45
|
tzinfo (~> 1.1)
|
46
|
+
addressable (2.4.0)
|
46
47
|
arel (6.0.0)
|
47
48
|
builder (3.2.2)
|
48
49
|
daemons (1.1.9)
|
49
50
|
diff-lcs (1.2.5)
|
50
51
|
erubis (2.7.0)
|
51
|
-
eventmachine (1.0.
|
52
|
-
faraday (0.9.
|
52
|
+
eventmachine (1.0.8)
|
53
|
+
faraday (0.9.2)
|
53
54
|
multipart-post (>= 1.2, < 3)
|
54
55
|
globalid (0.3.0)
|
55
56
|
activesupport (>= 4.1.0)
|
56
|
-
hashie (3.4.
|
57
|
+
hashie (3.4.3)
|
57
58
|
hike (1.2.3)
|
58
59
|
i18n (0.7.0)
|
59
|
-
json (1.8.
|
60
|
-
jwt (1.2
|
60
|
+
json (1.8.3)
|
61
|
+
jwt (1.5.2)
|
61
62
|
loofah (2.0.1)
|
62
63
|
nokogiri (>= 1.5.9)
|
63
64
|
mail (2.6.3)
|
@@ -65,7 +66,7 @@ GEM
|
|
65
66
|
mime-types (2.4.3)
|
66
67
|
mini_portile (0.6.2)
|
67
68
|
minitest (5.5.1)
|
68
|
-
multi_json (1.
|
69
|
+
multi_json (1.11.2)
|
69
70
|
multi_xml (0.5.5)
|
70
71
|
multipart-post (2.0.0)
|
71
72
|
nokogiri (1.6.6.2)
|
@@ -76,18 +77,19 @@ GEM
|
|
76
77
|
multi_json (~> 1.3)
|
77
78
|
multi_xml (~> 0.5)
|
78
79
|
rack (~> 1.2)
|
79
|
-
omniauth (1.
|
80
|
+
omniauth (1.3.1)
|
80
81
|
hashie (>= 1.2, < 4)
|
81
|
-
rack (
|
82
|
-
omniauth-google-oauth2 (0.
|
83
|
-
|
84
|
-
|
85
|
-
omniauth-oauth2 (1.2.0)
|
86
|
-
faraday (>= 0.8, < 0.10)
|
82
|
+
rack (>= 1.0, < 3)
|
83
|
+
omniauth-google-oauth2 (0.3.0)
|
84
|
+
addressable (~> 2.3)
|
85
|
+
jwt (~> 1.0)
|
87
86
|
multi_json (~> 1.3)
|
87
|
+
omniauth (>= 1.1.1)
|
88
|
+
omniauth-oauth2 (>= 1.3.1)
|
89
|
+
omniauth-oauth2 (1.4.0)
|
88
90
|
oauth2 (~> 1.0)
|
89
91
|
omniauth (~> 1.2)
|
90
|
-
rack (1.6.
|
92
|
+
rack (1.6.4)
|
91
93
|
rack-protection (1.5.3)
|
92
94
|
rack
|
93
95
|
rack-test (0.6.3)
|
@@ -130,10 +132,10 @@ GEM
|
|
130
132
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
133
|
rspec-support (~> 3.2.0)
|
132
134
|
rspec-support (3.2.0)
|
133
|
-
sinatra (1.4.
|
135
|
+
sinatra (1.4.6)
|
134
136
|
rack (~> 1.4)
|
135
137
|
rack-protection (~> 1.4)
|
136
|
-
tilt (
|
138
|
+
tilt (>= 1.3, < 3)
|
137
139
|
sprockets (2.12.3)
|
138
140
|
hike (~> 1.2)
|
139
141
|
multi_json (~> 1.0)
|
@@ -164,3 +166,6 @@ DEPENDENCIES
|
|
164
166
|
rspec
|
165
167
|
simple_admin_auth!
|
166
168
|
thin
|
169
|
+
|
170
|
+
BUNDLED WITH
|
171
|
+
1.10.6
|
data/README.md
CHANGED
@@ -34,6 +34,10 @@ Create an `config/initializers/admin_auth.rb` configuring your domain:
|
|
34
34
|
# The name must be `admin`
|
35
35
|
provider :google_oauth2, 'YOUR_KEY', 'YOUR_SECRET', name: 'admin',
|
36
36
|
access_type: 'online', hd: 'example.com', approval_prompt: 'auto'
|
37
|
+
|
38
|
+
# IMPORTANT: To restrict logins to your domain, you have to configure the
|
39
|
+
# required_hd. The :hd parameter for the provider is only a suggestion.
|
40
|
+
SimpleAdminAuth::Configuration.required_hd = 'example.com'
|
37
41
|
end
|
38
42
|
|
39
43
|
If you would like to white list emails in your domain add the following:
|
@@ -66,6 +70,10 @@ Sample config.ru:
|
|
66
70
|
# The name must be `admin`.
|
67
71
|
provider :google_oauth2, 'YOUR_KEY (client id)', 'YOUR_SECRET', name: 'admin',
|
68
72
|
access_type: 'online', hd: 'yourdomain.com', approval_prompt: 'auto'
|
73
|
+
|
74
|
+
# IMPORTANT: To restrict logins to your domain, you have to configure the
|
75
|
+
# required_hd. The :hd parameter for the provider is only a suggestion.
|
76
|
+
SimpleAdminAuth::Configuration.required_hd = 'yourdomain.com'
|
69
77
|
end
|
70
78
|
|
71
79
|
|
data/config.ru
CHANGED
@@ -18,12 +18,21 @@ app = Rack::Builder.new do
|
|
18
18
|
# You need to create a key for your app on https://code.google.com/apis/console/
|
19
19
|
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], name: 'admin',
|
20
20
|
access_type: 'online', hd: ENV['ADMIN_DOMAIN'], approval_prompt: 'auto'
|
21
|
+
|
22
|
+
SimpleAdminAuth::Configuration.required_hd = ENV['ADMIN_DOMAIN']
|
21
23
|
end
|
22
24
|
|
23
25
|
map "/admin" do
|
24
26
|
# This middleware only allows signed-in users to access this app.
|
25
27
|
use SimpleAdminAuth::RequireAdmin
|
26
|
-
run lambda { |env|
|
28
|
+
run lambda { |env|
|
29
|
+
body = <<-HTML
|
30
|
+
<p>Welcome, you have been authenticated!</p>
|
31
|
+
<p><a href="/auth/admin/logout">Sign Out</a></p>
|
32
|
+
<p>Details: #{Rack::Utils.escape_html(env['rack.session']['admin_user'].inspect)}</p>
|
33
|
+
HTML
|
34
|
+
[200, {'Content-Type' => 'text/html'}, [body]]
|
35
|
+
}
|
27
36
|
end
|
28
37
|
|
29
38
|
map "/" do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
daemons (1.1.9)
|
12
12
|
diff-lcs (1.2.4)
|
13
|
-
eventmachine (1.0.
|
13
|
+
eventmachine (1.0.8)
|
14
14
|
faraday (0.8.7)
|
15
15
|
multipart-post (~> 1.1)
|
16
16
|
hashie (2.0.4)
|
@@ -48,10 +48,10 @@ GEM
|
|
48
48
|
rspec-expectations (2.13.0)
|
49
49
|
diff-lcs (>= 1.1.3, < 2.0)
|
50
50
|
rspec-mocks (2.13.1)
|
51
|
-
sinatra (1.4.
|
51
|
+
sinatra (1.4.6)
|
52
52
|
rack (~> 1.4)
|
53
53
|
rack-protection (~> 1.4)
|
54
|
-
tilt (
|
54
|
+
tilt (>= 1.3, < 3)
|
55
55
|
thin (1.5.1)
|
56
56
|
daemons (>= 1.0.9)
|
57
57
|
eventmachine (>= 0.12.6)
|
@@ -69,3 +69,6 @@ DEPENDENCIES
|
|
69
69
|
rspec
|
70
70
|
simple_admin_auth!
|
71
71
|
thin
|
72
|
+
|
73
|
+
BUNDLED WITH
|
74
|
+
1.10.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
daemons (1.1.9)
|
12
12
|
diff-lcs (1.2.5)
|
13
|
-
eventmachine (1.0.
|
13
|
+
eventmachine (1.0.8)
|
14
14
|
faraday (0.9.1)
|
15
15
|
multipart-post (>= 1.2, < 3)
|
16
16
|
hashie (3.4.0)
|
@@ -54,10 +54,10 @@ GEM
|
|
54
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
55
|
rspec-support (~> 3.2.0)
|
56
56
|
rspec-support (3.2.0)
|
57
|
-
sinatra (1.4.
|
57
|
+
sinatra (1.4.6)
|
58
58
|
rack (~> 1.4)
|
59
59
|
rack-protection (~> 1.4)
|
60
|
-
tilt (
|
60
|
+
tilt (>= 1.3, < 3)
|
61
61
|
thin (1.6.3)
|
62
62
|
daemons (~> 1.0, >= 1.0.9)
|
63
63
|
eventmachine (~> 1.0)
|
@@ -75,3 +75,6 @@ DEPENDENCIES
|
|
75
75
|
rspec
|
76
76
|
simple_admin_auth!
|
77
77
|
thin
|
78
|
+
|
79
|
+
BUNDLED WITH
|
80
|
+
1.10.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
daemons (1.1.9)
|
41
41
|
diff-lcs (1.2.4)
|
42
42
|
erubis (2.7.0)
|
43
|
-
eventmachine (1.0.
|
43
|
+
eventmachine (1.0.8)
|
44
44
|
faraday (0.8.7)
|
45
45
|
multipart-post (~> 1.1)
|
46
46
|
hashie (2.0.4)
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
httpauth (0.2.0)
|
49
49
|
i18n (0.6.1)
|
50
50
|
journey (1.0.4)
|
51
|
-
json (1.
|
51
|
+
json (1.8.3)
|
52
52
|
jwt (0.1.8)
|
53
53
|
multi_json (>= 1.5)
|
54
54
|
mail (2.5.3)
|
@@ -109,10 +109,10 @@ GEM
|
|
109
109
|
rspec-expectations (2.13.0)
|
110
110
|
diff-lcs (>= 1.1.3, < 2.0)
|
111
111
|
rspec-mocks (2.13.1)
|
112
|
-
sinatra (1.4.
|
112
|
+
sinatra (1.4.6)
|
113
113
|
rack (~> 1.4)
|
114
114
|
rack-protection (~> 1.4)
|
115
|
-
tilt (
|
115
|
+
tilt (>= 1.3, < 3)
|
116
116
|
sprockets (2.2.2)
|
117
117
|
hike (~> 1.2)
|
118
118
|
multi_json (~> 1.0)
|
@@ -140,3 +140,6 @@ DEPENDENCIES
|
|
140
140
|
rspec
|
141
141
|
simple_admin_auth!
|
142
142
|
thin
|
143
|
+
|
144
|
+
BUNDLED WITH
|
145
|
+
1.10.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
daemons (1.1.9)
|
38
38
|
diff-lcs (1.2.5)
|
39
39
|
erubis (2.7.0)
|
40
|
-
eventmachine (1.0.
|
40
|
+
eventmachine (1.0.8)
|
41
41
|
faraday (0.9.0)
|
42
42
|
multipart-post (>= 1.2, < 3)
|
43
43
|
hashie (3.3.1)
|
@@ -101,10 +101,10 @@ GEM
|
|
101
101
|
rspec-mocks (3.1.0)
|
102
102
|
rspec-support (~> 3.1.0)
|
103
103
|
rspec-support (3.1.0)
|
104
|
-
sinatra (1.4.
|
104
|
+
sinatra (1.4.6)
|
105
105
|
rack (~> 1.4)
|
106
106
|
rack-protection (~> 1.4)
|
107
|
-
tilt (
|
107
|
+
tilt (>= 1.3, < 3)
|
108
108
|
sprockets (2.12.2)
|
109
109
|
hike (~> 1.2)
|
110
110
|
multi_json (~> 1.0)
|
@@ -137,3 +137,6 @@ DEPENDENCIES
|
|
137
137
|
rspec
|
138
138
|
simple_admin_auth!
|
139
139
|
thin
|
140
|
+
|
141
|
+
BUNDLED WITH
|
142
|
+
1.10.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -39,13 +39,13 @@ GEM
|
|
39
39
|
daemons (1.1.9)
|
40
40
|
diff-lcs (1.2.5)
|
41
41
|
erubis (2.7.0)
|
42
|
-
eventmachine (1.0.
|
42
|
+
eventmachine (1.0.8)
|
43
43
|
faraday (0.9.0)
|
44
44
|
multipart-post (>= 1.2, < 3)
|
45
45
|
hashie (3.3.1)
|
46
46
|
hike (1.2.3)
|
47
47
|
i18n (0.6.11)
|
48
|
-
json (1.8.
|
48
|
+
json (1.8.3)
|
49
49
|
jwt (1.0.0)
|
50
50
|
mail (2.5.4)
|
51
51
|
mime-types (~> 1.16)
|
@@ -106,10 +106,10 @@ GEM
|
|
106
106
|
rspec-mocks (3.1.0)
|
107
107
|
rspec-support (~> 3.1.0)
|
108
108
|
rspec-support (3.1.0)
|
109
|
-
sinatra (1.4.
|
109
|
+
sinatra (1.4.6)
|
110
110
|
rack (~> 1.4)
|
111
111
|
rack-protection (~> 1.4)
|
112
|
-
tilt (
|
112
|
+
tilt (>= 1.3, < 3)
|
113
113
|
sprockets (2.12.2)
|
114
114
|
hike (~> 1.2)
|
115
115
|
multi_json (~> 1.0)
|
@@ -143,3 +143,6 @@ DEPENDENCIES
|
|
143
143
|
rspec
|
144
144
|
simple_admin_auth!
|
145
145
|
thin
|
146
|
+
|
147
|
+
BUNDLED WITH
|
148
|
+
1.10.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
simple_admin_auth (0.1.
|
4
|
+
simple_admin_auth (0.1.4)
|
5
5
|
omniauth
|
6
6
|
sinatra
|
7
7
|
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
daemons (1.1.9)
|
49
49
|
diff-lcs (1.2.5)
|
50
50
|
erubis (2.7.0)
|
51
|
-
eventmachine (1.0.
|
51
|
+
eventmachine (1.0.8)
|
52
52
|
faraday (0.9.1)
|
53
53
|
multipart-post (>= 1.2, < 3)
|
54
54
|
globalid (0.3.0)
|
@@ -56,7 +56,7 @@ GEM
|
|
56
56
|
hashie (3.4.0)
|
57
57
|
hike (1.2.3)
|
58
58
|
i18n (0.7.0)
|
59
|
-
json (1.8.
|
59
|
+
json (1.8.3)
|
60
60
|
jwt (1.2.1)
|
61
61
|
loofah (2.0.1)
|
62
62
|
nokogiri (>= 1.5.9)
|
@@ -130,10 +130,10 @@ GEM
|
|
130
130
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
131
|
rspec-support (~> 3.2.0)
|
132
132
|
rspec-support (3.2.0)
|
133
|
-
sinatra (1.4.
|
133
|
+
sinatra (1.4.6)
|
134
134
|
rack (~> 1.4)
|
135
135
|
rack-protection (~> 1.4)
|
136
|
-
tilt (
|
136
|
+
tilt (>= 1.3, < 3)
|
137
137
|
sprockets (2.12.3)
|
138
138
|
hike (~> 1.2)
|
139
139
|
multi_json (~> 1.0)
|
@@ -164,3 +164,6 @@ DEPENDENCIES
|
|
164
164
|
rspec
|
165
165
|
simple_admin_auth!
|
166
166
|
thin
|
167
|
+
|
168
|
+
BUNDLED WITH
|
169
|
+
1.10.6
|
@@ -15,6 +15,20 @@ module SimpleAdminAuth
|
|
15
15
|
get_or_post '/admin/callback' do
|
16
16
|
auth_hash = request.env['omniauth.auth']
|
17
17
|
|
18
|
+
unless SimpleAdminAuth::Configuration.required_hd.nil?
|
19
|
+
hd = nil
|
20
|
+
if auth_hash.extra && auth_hash.extra.id_info
|
21
|
+
hd = auth_hash.extra.id_info.hd
|
22
|
+
end
|
23
|
+
|
24
|
+
if hd != SimpleAdminAuth::Configuration.required_hd
|
25
|
+
# Hosted domain doesn't match
|
26
|
+
throw(:halt, [401, "Not authorized\n"])
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
18
32
|
session[:admin_user] = auth_hash['info']
|
19
33
|
|
20
34
|
return_url = session[:admin_login_return_url] || '/'
|
@@ -1,5 +1,13 @@
|
|
1
1
|
shared_examples "integration" do
|
2
2
|
|
3
|
+
before(:each) do
|
4
|
+
OmniAuth.config.add_mock(:admin, {:uid => '12345', info: {email: 'foo@bar.com'}})
|
5
|
+
end
|
6
|
+
|
7
|
+
after(:each) do
|
8
|
+
SimpleAdminAuth::Configuration.required_hd = nil
|
9
|
+
end
|
10
|
+
|
3
11
|
it "should get the unprotected index page" do
|
4
12
|
get '/'
|
5
13
|
last_response.status.should == 200
|
@@ -41,4 +49,62 @@ shared_examples "integration" do
|
|
41
49
|
last_request.url.should =~ /\/protected\/test$/
|
42
50
|
last_response.should be_ok
|
43
51
|
end
|
44
|
-
|
52
|
+
|
53
|
+
it "should fail when required hd is not present" do
|
54
|
+
SimpleAdminAuth::Configuration.required_hd = 'example.org'
|
55
|
+
|
56
|
+
get '/protected/test'
|
57
|
+
# Redirect to login page
|
58
|
+
follow_redirect!
|
59
|
+
|
60
|
+
# Click the login button
|
61
|
+
get '/auth/admin'
|
62
|
+
last_response.status.should == 302
|
63
|
+
follow_redirect!
|
64
|
+
|
65
|
+
# Mock strategy immediately redirects to the callback
|
66
|
+
last_request.url.should =~ /auth\/admin\/callback$/
|
67
|
+
last_response.status.should == 401
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should login if the required hd is present" do
|
71
|
+
SimpleAdminAuth::Configuration.required_hd = 'example.org'
|
72
|
+
OmniAuth.config.add_mock(:admin, {:uid => '12345', info: {email: 'foo@bar.com'}, extra: {id_info: {hd: 'example.org'}}})
|
73
|
+
get '/protected/test'
|
74
|
+
# Redirect to login page
|
75
|
+
follow_redirect!
|
76
|
+
|
77
|
+
# Click the login button
|
78
|
+
get '/auth/admin'
|
79
|
+
last_response.status.should == 302
|
80
|
+
follow_redirect!
|
81
|
+
|
82
|
+
# Mock strategy immediately redirects to the callback
|
83
|
+
last_request.url.should =~ /auth\/admin\/callback$/
|
84
|
+
follow_redirect!
|
85
|
+
|
86
|
+
# We should be redirected back to the original page
|
87
|
+
last_request.url.should =~ /\/protected\/test$/
|
88
|
+
last_response.should be_ok
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should fail when required hd is wrong" do
|
92
|
+
# email matches, but the returnd hd doesn't.
|
93
|
+
SimpleAdminAuth::Configuration.required_hd = 'bar.com'
|
94
|
+
OmniAuth.config.add_mock(:admin, {:uid => '12345', info: {email: 'foo@bar.com'}, extra: {id_info: {hd: 'example.org'}}})
|
95
|
+
|
96
|
+
get '/protected/test'
|
97
|
+
# Redirect to login page
|
98
|
+
follow_redirect!
|
99
|
+
|
100
|
+
# Click the login button
|
101
|
+
get '/auth/admin'
|
102
|
+
last_response.status.should == 302
|
103
|
+
follow_redirect!
|
104
|
+
|
105
|
+
# Mock strategy immediately redirects to the callback
|
106
|
+
last_request.url.should =~ /auth\/admin\/callback$/
|
107
|
+
last_response.status.should == 401
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_admin_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralf Kistner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.4.8
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Simple admin authentication using Google Apps
|