devise_saml_authenticatable 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +11 -1
- data/README.md +3 -3
- data/devise_saml_authenticatable.gemspec +2 -1
- data/lib/devise_saml_authenticatable/saml_config.rb +1 -1
- data/lib/devise_saml_authenticatable/version.rb +1 -1
- data/spec/controllers/devise/saml_sessions_controller_spec.rb +2 -2
- data/spec/devise_saml_authenticatable/model_spec.rb +27 -27
- data/spec/devise_saml_authenticatable/saml_config_spec.rb +6 -6
- data/spec/devise_saml_authenticatable/strategy_spec.rb +1 -1
- data/spec/support/idp_settings_adapter.rb.erb +1 -1
- data/spec/support/sp_template.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d503c9931a5af5182f1f6910dcfc548d692fcc3e45ad2fb464b3931c4791ac59
|
4
|
+
data.tar.gz: 6da638f28754c2a8f9d44d38a8a61f0796b04e023e0dba8d845fb60bc004bebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d44c5c95a396f22008c33b4636fd201c6d6ec71a5193909bb6cc1aa59f660301831cada23e589b05ed52260d8a1a2e42a7442a72757f821ef6ede752a26554e
|
7
|
+
data.tar.gz: '0603740818f257bc90e63f4732c59c6d8a686e0d28c9dedb6cf8ce877a06234e51d39376602d105660e3e25744dfe0163dec931b436ec3bfbe9aabbf06167e36'
|
data/.github/workflows/ci.yml
CHANGED
@@ -12,6 +12,7 @@ jobs:
|
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
14
|
ruby:
|
15
|
+
- "3.2"
|
15
16
|
- "3.1"
|
16
17
|
- "3.0"
|
17
18
|
- "2.7"
|
@@ -39,11 +40,20 @@ jobs:
|
|
39
40
|
- ruby: "3.1"
|
40
41
|
gemfile: spec/support/Gemfile.rails6
|
41
42
|
bundler: "2"
|
43
|
+
- ruby: "3.2"
|
44
|
+
gemfile: spec/support/Gemfile.rails5.2
|
45
|
+
bundler: "2"
|
46
|
+
- ruby: "3.2"
|
47
|
+
gemfile: spec/support/Gemfile.rails6
|
48
|
+
bundler: "2"
|
49
|
+
- ruby: "3.2"
|
50
|
+
gemfile: spec/support/Gemfile.rails6.1
|
51
|
+
bundler: "2"
|
42
52
|
runs-on: ubuntu-latest
|
43
53
|
env:
|
44
54
|
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
45
55
|
steps:
|
46
|
-
- uses: actions/checkout@
|
56
|
+
- uses: actions/checkout@v3
|
47
57
|
- uses: ruby/setup-ruby@v1
|
48
58
|
with:
|
49
59
|
bundler: ${{ matrix.bundler }}
|
data/README.md
CHANGED
@@ -151,7 +151,7 @@ In `config/initializers/devise.rb`:
|
|
151
151
|
settings.assertion_consumer_service_url = "http://localhost:3000/users/saml/auth"
|
152
152
|
settings.assertion_consumer_service_binding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
|
153
153
|
settings.name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
|
154
|
-
settings.
|
154
|
+
settings.sp_entity_id = "http://localhost:3000/saml/metadata"
|
155
155
|
settings.authn_context = ""
|
156
156
|
settings.idp_slo_service_url = "http://localhost/simplesaml/www/saml2/idp/SingleLogoutService.php"
|
157
157
|
settings.idp_sso_service_url = "http://localhost/simplesaml/www/saml2/idp/SSOService.php"
|
@@ -240,7 +240,7 @@ class IdPSettingsAdapter
|
|
240
240
|
assertion_consumer_service_url: "#{request.protocol}#{request.host_with_port}/users/saml/auth",
|
241
241
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
242
242
|
name_identifier_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
|
243
|
-
|
243
|
+
sp_entity_id: "#{request.protocol}#{request.host_with_port}/saml/metadata",
|
244
244
|
idp_entity_id: "http://www.example_idp_entity_id.com",
|
245
245
|
authn_context: "",
|
246
246
|
idp_slo_service_url: "http://example_idp_slo_service_url.com",
|
@@ -252,7 +252,7 @@ class IdPSettingsAdapter
|
|
252
252
|
assertion_consumer_service_url: "http://localhost:3000/users/saml/auth",
|
253
253
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
254
254
|
name_identifier_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
|
255
|
-
|
255
|
+
sp_entity_id: "http://localhost:3000/saml/metadata",
|
256
256
|
idp_entity_id: "http://www.another_idp_entity_id.biz",
|
257
257
|
authn_context: "",
|
258
258
|
idp_slo_service_url: "http://another_idp_slo_service_url.com",
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["Josef.Sauter@gmail.com"]
|
7
7
|
gem.description = %q{SAML Authentication for devise}
|
8
8
|
gem.summary = %q{SAML Authentication for devise }
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/apokalipto/devise_saml_authenticatable"
|
10
10
|
gem.license = "MIT"
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = DeviseSamlAuthenticatable::VERSION
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.required_ruby_version = ">= 2.6.0"
|
19
20
|
|
20
21
|
gem.add_dependency("devise","> 2.0.0")
|
21
22
|
gem.add_dependency("ruby-saml","~> 1.7")
|
@@ -14,7 +14,7 @@ module DeviseSamlAuthenticatable
|
|
14
14
|
return @file_based_config if @file_based_config
|
15
15
|
idp_config_path = "#{Rails.root}/config/idp.yml"
|
16
16
|
|
17
|
-
if File.
|
17
|
+
if File.exist?(idp_config_path)
|
18
18
|
@file_based_config ||= OneLogin::RubySaml::Settings.new(YAML.load(File.read(idp_config_path))[Rails.env])
|
19
19
|
end
|
20
20
|
end
|
@@ -40,7 +40,7 @@ describe Devise::SamlSessionsController, type: :controller do
|
|
40
40
|
assertion_consumer_service_url: 'acs_url',
|
41
41
|
assertion_consumer_service_binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
42
42
|
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
|
43
|
-
|
43
|
+
sp_entity_id: 'sp_issuer',
|
44
44
|
idp_entity_id: 'http://www.example.com',
|
45
45
|
authn_context: '',
|
46
46
|
idp_cert: 'idp_cert'
|
@@ -167,7 +167,7 @@ describe Devise::SamlSessionsController, type: :controller do
|
|
167
167
|
settings.assertion_consumer_service_url = 'http://localhost:3000/users/saml/auth'
|
168
168
|
settings.assertion_consumer_service_binding = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
|
169
169
|
settings.name_identifier_format = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
|
170
|
-
settings.
|
170
|
+
settings.sp_entity_id = 'http://localhost:3000'
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
@@ -64,12 +64,12 @@ describe Devise::Models::SamlAuthenticatable do
|
|
64
64
|
|
65
65
|
it "looks up the user by the configured default user key" do
|
66
66
|
user = Model.new(new_record: false)
|
67
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
67
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
68
68
|
expect(Model.authenticate_with_saml(response, nil)).to eq(user)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "returns nil if it cannot find a user" do
|
72
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
72
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
73
73
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
74
74
|
end
|
75
75
|
|
@@ -83,12 +83,12 @@ describe Devise::Models::SamlAuthenticatable do
|
|
83
83
|
|
84
84
|
it "looks up the user by the configured default user key" do
|
85
85
|
user = Model.new(new_record: false)
|
86
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
86
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
87
87
|
expect(Model.authenticate_with_saml(response, nil)).to eq(user)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "returns nil if it cannot find a user" do
|
91
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
91
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
92
92
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
93
93
|
end
|
94
94
|
|
@@ -98,7 +98,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it "creates and returns a new user with the name identifier and given attributes" do
|
101
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
101
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
102
102
|
model = Model.authenticate_with_saml(response, nil)
|
103
103
|
expect(model.email).to eq('user@example.com')
|
104
104
|
expect(model.name).to eq('A User')
|
@@ -114,7 +114,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
114
114
|
|
115
115
|
context "when the proc returns true" do
|
116
116
|
it "creates and returns a new user with the name identifier and given attributes" do
|
117
|
-
expect(Model).to receive(:where).with(email: name_id).and_return([])
|
117
|
+
expect(Model).to receive(:where).with({ email: name_id }).and_return([])
|
118
118
|
model = Model.authenticate_with_saml(response, nil)
|
119
119
|
expect(model.email).to eq('user@example.com')
|
120
120
|
expect(model.name).to eq('A User')
|
@@ -126,7 +126,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
126
126
|
let(:name_id) { 'do_not_create@example.com' }
|
127
127
|
|
128
128
|
it "does not creates new user" do
|
129
|
-
expect(Model).to receive(:where).with(email: name_id).and_return([])
|
129
|
+
expect(Model).to receive(:where).with({ email: name_id }).and_return([])
|
130
130
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
131
131
|
end
|
132
132
|
end
|
@@ -139,7 +139,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
139
139
|
|
140
140
|
it "creates and returns a new user with the name identifier and given attributes" do
|
141
141
|
user = Model.new(email: "old_mail@mail.com", name: "old name", new_record: false)
|
142
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
142
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
143
143
|
model = Model.authenticate_with_saml(response, nil)
|
144
144
|
expect(model.email).to eq('user@example.com')
|
145
145
|
expect(model.name).to eq('A User')
|
@@ -157,7 +157,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
157
157
|
|
158
158
|
context "when the proc returns true" do
|
159
159
|
it "updates user with given attributes" do
|
160
|
-
expect(Model).to receive(:where).with(email: name_id).and_return([user])
|
160
|
+
expect(Model).to receive(:where).with({ email: name_id }).and_return([user])
|
161
161
|
model = Model.authenticate_with_saml(response, nil)
|
162
162
|
expect(model.email).to eq('user@example.com')
|
163
163
|
expect(model.name).to eq('A User')
|
@@ -169,7 +169,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
169
169
|
let(:name_id) { 'do_not_update@example.com' }
|
170
170
|
|
171
171
|
it "does not update user" do
|
172
|
-
expect(Model).to receive(:where).with(email: name_id).and_return([user])
|
172
|
+
expect(Model).to receive(:where).with({ email: name_id }).and_return([user])
|
173
173
|
model = Model.authenticate_with_saml(response, nil)
|
174
174
|
expect(model.email).to eq('old_mail@mail.com')
|
175
175
|
expect(model.name).to eq('old name')
|
@@ -185,7 +185,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
185
185
|
end
|
186
186
|
|
187
187
|
it "creates and returns a new user with the given attributes" do
|
188
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
188
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
189
189
|
model = Model.authenticate_with_saml(response, nil)
|
190
190
|
expect(model.email).to eq('user@example.com')
|
191
191
|
expect(model.name).to eq('A User')
|
@@ -204,7 +204,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
204
204
|
let(:response) { double(:response, issuers: ['to_create_idp'], attributes: attributes, name_id: name_id) }
|
205
205
|
|
206
206
|
it "creates and returns a new user with the name identifier and given attributes" do
|
207
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
207
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
208
208
|
model = Model.authenticate_with_saml(response, nil)
|
209
209
|
expect(model.email).to eq('user@example.com')
|
210
210
|
expect(model.name).to eq('A User')
|
@@ -216,7 +216,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
216
216
|
let(:response) { double(:response, issuers: ['do_not_create_idp'], attributes: attributes, name_id: name_id) }
|
217
217
|
|
218
218
|
it "does not creates new user" do
|
219
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
219
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
220
220
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
221
221
|
end
|
222
222
|
end
|
@@ -228,13 +228,13 @@ describe Devise::Models::SamlAuthenticatable do
|
|
228
228
|
end
|
229
229
|
|
230
230
|
it "returns nil if the user is not found" do
|
231
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
231
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
232
232
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
233
233
|
end
|
234
234
|
|
235
235
|
it "updates the attributes if the user is found" do
|
236
236
|
user = Model.new(email: "old_mail@mail.com", name: "old name", new_record: false)
|
237
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
237
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
238
238
|
model = Model.authenticate_with_saml(response, nil)
|
239
239
|
expect(model.email).to eq('user@example.com')
|
240
240
|
expect(model.name).to eq('A User')
|
@@ -254,7 +254,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
254
254
|
let(:response) { double(:response, issuers: ['to_update_idp'], attributes: attributes, name_id: name_id) }
|
255
255
|
|
256
256
|
it "updates user with given attributes" do
|
257
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
257
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
258
258
|
model = Model.authenticate_with_saml(response, nil)
|
259
259
|
expect(model.email).to eq('user@example.com')
|
260
260
|
expect(model.name).to eq('A User')
|
@@ -266,7 +266,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
266
266
|
let(:response) { double(:response, issuers: ['do_not_update_idp'], attributes: attributes, name_id: name_id) }
|
267
267
|
|
268
268
|
it "does not update user" do
|
269
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
269
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
270
270
|
model = Model.authenticate_with_saml(response, nil)
|
271
271
|
expect(model.email).to eq('old_mail@mail.com')
|
272
272
|
expect(model.name).to eq('old name')
|
@@ -282,7 +282,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
282
282
|
|
283
283
|
it "looks up the user with a downcased value" do
|
284
284
|
user = Model.new(new_record: false)
|
285
|
-
expect(Model).to receive(:where).with(email: 'upper@example.com').and_return([user])
|
285
|
+
expect(Model).to receive(:where).with({ email: 'upper@example.com' }).and_return([user])
|
286
286
|
expect(Model.authenticate_with_saml(response, nil)).to eq(user)
|
287
287
|
end
|
288
288
|
end
|
@@ -320,7 +320,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
320
320
|
end
|
321
321
|
|
322
322
|
it "returns the user" do
|
323
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
323
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
324
324
|
expect(Model.authenticate_with_saml(response, nil)).to eq(user)
|
325
325
|
end
|
326
326
|
end
|
@@ -331,7 +331,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
331
331
|
end
|
332
332
|
|
333
333
|
it "returns nil" do
|
334
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
334
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
335
335
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
336
336
|
end
|
337
337
|
end
|
@@ -354,7 +354,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
354
354
|
end
|
355
355
|
|
356
356
|
it "returns the user" do
|
357
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
357
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
358
358
|
expect(Model.authenticate_with_saml(response, nil)).to eq(user)
|
359
359
|
end
|
360
360
|
end
|
@@ -365,7 +365,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
365
365
|
end
|
366
366
|
|
367
367
|
it "returns nil" do
|
368
|
-
expect(Model).to receive(:where).with(email: 'user@example.com').and_return([user])
|
368
|
+
expect(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([user])
|
369
369
|
expect(Model.authenticate_with_saml(response, nil)).to be_nil
|
370
370
|
end
|
371
371
|
end
|
@@ -412,7 +412,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
412
412
|
end
|
413
413
|
|
414
414
|
def configure_hook(&block)
|
415
|
-
allow(Model).to receive(:where).with(email: 'user@example.com').and_return([])
|
415
|
+
allow(Model).to receive(:where).with({ email: 'user@example.com' }).and_return([])
|
416
416
|
allow(Devise).to receive(:saml_default_user_key).and_return(:email)
|
417
417
|
allow(Devise).to receive(:saml_create_user).and_return(true)
|
418
418
|
allow(Devise).to receive(:saml_update_resource_hook).and_return(block)
|
@@ -423,7 +423,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
423
423
|
let(:name_id) { 'SomeUsername' }
|
424
424
|
|
425
425
|
it "can replicate the default behaviour for a new user in a custom locator" do
|
426
|
-
allow(Model).to receive(:where).with(email: attributes['saml-email-format']).and_return([])
|
426
|
+
allow(Model).to receive(:where).with({ email: attributes['saml-email-format'] }).and_return([])
|
427
427
|
|
428
428
|
configure_hook do |model, saml_response, auth_value|
|
429
429
|
Devise.saml_default_resource_locator.call(model, saml_response, auth_value)
|
@@ -439,7 +439,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
439
439
|
user = Model.new(email: attributes['saml-email-format'], name: attributes['saml-name-format'])
|
440
440
|
user.save!
|
441
441
|
|
442
|
-
allow(Model).to receive(:where).with(email: attributes['saml-email-format']).and_return([user])
|
442
|
+
allow(Model).to receive(:where).with({ email: attributes['saml-email-format'] }).and_return([user])
|
443
443
|
|
444
444
|
configure_hook do |model, saml_response, auth_value|
|
445
445
|
Devise.saml_default_resource_locator.call(model, saml_response, auth_value)
|
@@ -453,7 +453,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
453
453
|
end
|
454
454
|
|
455
455
|
it "can change the default behaviour for a new user from the saml response" do
|
456
|
-
allow(Model).to receive(:where).with(foo: attributes['saml-email-format'], bar: name_id).and_return([])
|
456
|
+
allow(Model).to receive(:where).with({ foo: attributes['saml-email-format'], bar: name_id }).and_return([])
|
457
457
|
|
458
458
|
configure_hook do |model, saml_response, auth_value|
|
459
459
|
name_id = saml_response.raw_response.name_id
|
@@ -470,7 +470,7 @@ describe Devise::Models::SamlAuthenticatable do
|
|
470
470
|
user = Model.new(email: attributes['saml-email-format'], name: attributes['saml-name-format'])
|
471
471
|
user.save!
|
472
472
|
|
473
|
-
allow(Model).to receive(:where).with(foo: attributes['saml-email-format'], bar: name_id).and_return([user])
|
473
|
+
allow(Model).to receive(:where).with({ foo: attributes['saml-email-format'], bar: name_id }).and_return([user])
|
474
474
|
|
475
475
|
configure_hook do |model, saml_response, auth_value|
|
476
476
|
name_id = saml_response.raw_response.name_id
|
@@ -10,7 +10,7 @@ describe DeviseSamlAuthenticatable::SamlConfig do
|
|
10
10
|
context "when config/idp.yml does not exist" do
|
11
11
|
before do
|
12
12
|
allow(Rails).to receive(:root).and_return("/railsroot")
|
13
|
-
allow(File).to receive(:
|
13
|
+
allow(File).to receive(:exist?).with("/railsroot/config/idp.yml").and_return(false)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "is the global devise SAML config" do
|
@@ -38,7 +38,7 @@ describe DeviseSamlAuthenticatable::SamlConfig do
|
|
38
38
|
assertion_consumer_service_url: "acs_url",
|
39
39
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
40
40
|
name_identifier_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
|
41
|
-
|
41
|
+
sp_entity_id: "sp_issuer",
|
42
42
|
idp_entity_id: "http://www.example.com",
|
43
43
|
authn_context: "",
|
44
44
|
idp_cert: "idp_cert"
|
@@ -60,7 +60,7 @@ describe DeviseSamlAuthenticatable::SamlConfig do
|
|
60
60
|
assertion_consumer_service_url: "acs_url_other",
|
61
61
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST_other",
|
62
62
|
name_identifier_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress_other",
|
63
|
-
|
63
|
+
sp_entity_id: "sp_issuer_other",
|
64
64
|
idp_entity_id: "http://www.example.com_other",
|
65
65
|
authn_context: "_other",
|
66
66
|
idp_cert: "idp_cert_other"
|
@@ -134,7 +134,7 @@ environment:
|
|
134
134
|
idp_cert_fingerprint: idp_cert_fingerprint
|
135
135
|
idp_cert_fingerprint_algorithm: idp_cert_fingerprint_algorithm
|
136
136
|
idp_entity_id: idp_entity_id
|
137
|
-
|
137
|
+
sp_entity_id: issuer
|
138
138
|
name_identifier_format: name_identifier_format
|
139
139
|
name_identifier_value: name_identifier_value
|
140
140
|
passive: passive
|
@@ -156,7 +156,7 @@ TARGET_URLS
|
|
156
156
|
before do
|
157
157
|
allow(Rails).to receive(:env).and_return("environment")
|
158
158
|
allow(Rails).to receive(:root).and_return("/railsroot")
|
159
|
-
allow(File).to receive(:
|
159
|
+
allow(File).to receive(:exist?).with("/railsroot/config/idp.yml").and_return(true)
|
160
160
|
allow(File).to receive(:read).with("/railsroot/config/idp.yml").and_return(idp_yaml)
|
161
161
|
end
|
162
162
|
|
@@ -185,7 +185,7 @@ TARGET_URLS
|
|
185
185
|
expect(saml_config.idp_slo_target_url).to eq('idp_slo_service_url')
|
186
186
|
expect(saml_config.idp_sso_target_url).to eq('idp_sso_service_url')
|
187
187
|
})
|
188
|
-
expect(saml_config.
|
188
|
+
expect(saml_config.sp_entity_id).to eq('issuer')
|
189
189
|
expect(saml_config.name_identifier_format).to eq('name_identifier_format')
|
190
190
|
expect(saml_config.name_identifier_value).to eq('name_identifier_value')
|
191
191
|
expect(saml_config.passive).to eq('passive')
|
@@ -61,7 +61,7 @@ describe Devise::Strategies::SamlAuthenticatable do
|
|
61
61
|
assertion_consumer_service_url: "acs url",
|
62
62
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
63
63
|
name_identifier_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
|
64
|
-
|
64
|
+
sp_entity_id: "sp_issuer",
|
65
65
|
idp_entity_id: "http://www.example.com",
|
66
66
|
authn_context: "",
|
67
67
|
idp_cert: "idp_cert"
|
@@ -5,7 +5,7 @@ class IdpSettingsAdapter
|
|
5
5
|
assertion_consumer_service_url: "http://localhost:8020/users/saml/auth",
|
6
6
|
assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
7
7
|
name_identifier_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
|
8
|
-
|
8
|
+
sp_entity_id: "sp_issuer",
|
9
9
|
idp_entity_id: "http://localhost:8020/saml/metadata",
|
10
10
|
authn_context: "",
|
11
11
|
idp_cert_fingerprint: "9E:65:2E:03:06:8D:80:F2:86:C7:6C:77:A1:D9:14:97:0A:4D:F4:4D"
|
data/spec/support/sp_template.rb
CHANGED
@@ -83,7 +83,7 @@ after_bundle do
|
|
83
83
|
|
84
84
|
config.saml_configure do |settings|
|
85
85
|
settings.assertion_consumer_service_url = "http://localhost:8020/users/saml/auth"
|
86
|
-
settings.
|
86
|
+
settings.sp_entity_id = "http://localhost:8020/saml/metadata"
|
87
87
|
settings.idp_cert_fingerprint = "9E:65:2E:03:06:8D:80:F2:86:C7:6C:77:A1:D9:14:97:0A:4D:F4:4D"
|
88
88
|
settings.name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
|
89
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_saml_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Sauter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".github/dependabot.yml"
|
48
49
|
- ".github/workflows/ci.yml"
|
49
50
|
- ".gitignore"
|
50
51
|
- ".rspec"
|
@@ -92,7 +93,7 @@ files:
|
|
92
93
|
- spec/support/saml_idp-saml_slo_post.html.erb
|
93
94
|
- spec/support/saml_idp_controller.rb.erb
|
94
95
|
- spec/support/sp_template.rb
|
95
|
-
homepage:
|
96
|
+
homepage: https://github.com/apokalipto/devise_saml_authenticatable
|
96
97
|
licenses:
|
97
98
|
- MIT
|
98
99
|
metadata: {}
|
@@ -104,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
105
|
requirements:
|
105
106
|
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
108
|
+
version: 2.6.0
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
111
|
- - ">="
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
+
rubygems_version: 3.4.1
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: SAML Authentication for devise
|