saml_idp 0.8.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -47
  3. data/lib/saml_idp/assertion_builder.rb +28 -3
  4. data/lib/saml_idp/configurator.rb +6 -1
  5. data/lib/saml_idp/controller.rb +19 -11
  6. data/lib/saml_idp/encryptor.rb +0 -1
  7. data/lib/saml_idp/fingerprint.rb +19 -0
  8. data/lib/saml_idp/incoming_metadata.rb +18 -0
  9. data/lib/saml_idp/metadata_builder.rb +23 -8
  10. data/lib/saml_idp/persisted_metadata.rb +4 -0
  11. data/lib/saml_idp/request.rb +13 -6
  12. data/lib/saml_idp/response_builder.rb +26 -6
  13. data/lib/saml_idp/saml_response.rb +62 -28
  14. data/lib/saml_idp/service_provider.rb +1 -6
  15. data/lib/saml_idp/signable.rb +1 -2
  16. data/lib/saml_idp/version.rb +1 -1
  17. data/lib/saml_idp/xml_security.rb +1 -1
  18. data/lib/saml_idp.rb +2 -1
  19. data/saml_idp.gemspec +31 -31
  20. data/spec/lib/saml_idp/assertion_builder_spec.rb +143 -0
  21. data/spec/lib/saml_idp/configurator_spec.rb +2 -0
  22. data/spec/lib/saml_idp/controller_spec.rb +24 -0
  23. data/spec/lib/saml_idp/fingerprint_spec.rb +14 -0
  24. data/spec/lib/saml_idp/incoming_metadata_spec.rb +20 -1
  25. data/spec/lib/saml_idp/metadata_builder_spec.rb +23 -0
  26. data/spec/lib/saml_idp/request_spec.rb +43 -9
  27. data/spec/lib/saml_idp/response_builder_spec.rb +3 -1
  28. data/spec/lib/saml_idp/saml_response_spec.rb +122 -7
  29. data/spec/rails_app/app/controllers/saml_controller.rb +1 -5
  30. data/spec/rails_app/app/controllers/saml_idp_controller.rb +55 -3
  31. data/{app → spec/rails_app/app}/views/saml_idp/idp/new.html.erb +1 -5
  32. data/{app → spec/rails_app/app}/views/saml_idp/idp/saml_post.html.erb +1 -1
  33. data/spec/rails_app/config/application.rb +1 -0
  34. data/spec/rails_app/config/boot.rb +1 -1
  35. data/spec/rails_app/config/environments/development.rb +2 -0
  36. data/spec/spec_helper.rb +20 -1
  37. data/spec/support/certificates/sp_cert_req.csr +12 -0
  38. data/spec/support/certificates/sp_private_key.pem +16 -0
  39. data/spec/support/certificates/sp_x509_cert.crt +18 -0
  40. data/spec/support/saml_request_macros.rb +62 -3
  41. data/spec/support/security_helpers.rb +10 -0
  42. metadata +83 -61
  43. data/app/controllers/saml_idp/idp_controller.rb +0 -59
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml_idp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Phenow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-09 00:00:00.000000000 Z
11
+ date: 2023-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,72 +16,86 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: uuid
28
+ name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.3'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.3'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: builder
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 1.6.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: 1.6.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: nokogiri
56
+ name: rexml
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.6.2
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.6.2
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: xmlenc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.7.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.7.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: activeresource
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '5.1'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '5.1'
83
97
  - !ruby/object:Gem::Dependency
84
- name: simplecov
98
+ name: appraisal
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,117 +109,117 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: rspec
112
+ name: byebug
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: 3.7.0
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: 3.7.0
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: ruby-saml
126
+ name: capybara
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '1.5'
131
+ version: '2.16'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '1.5'
138
+ version: '2.16'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rails
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '3.2'
145
+ version: '5.2'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '3.2'
152
+ version: '5.2'
139
153
  - !ruby/object:Gem::Dependency
140
- name: activeresource
154
+ name: rake
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: '3.2'
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: '3.2'
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: capybara
168
+ name: rspec
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ">="
158
172
  - !ruby/object:Gem::Version
159
- version: '2.16'
173
+ version: 3.7.0
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
- version: '2.16'
180
+ version: 3.7.0
167
181
  - !ruby/object:Gem::Dependency
168
- name: timecop
182
+ name: ruby-saml
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
172
186
  - !ruby/object:Gem::Version
173
- version: '0.8'
187
+ version: 1.7.2
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
- version: '0.8'
194
+ version: 1.7.2
181
195
  - !ruby/object:Gem::Dependency
182
- name: xmlenc
196
+ name: simplecov
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - ">="
186
200
  - !ruby/object:Gem::Version
187
- version: 0.6.4
201
+ version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - ">="
193
207
  - !ruby/object:Gem::Version
194
- version: 0.6.4
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
- name: appraisal
210
+ name: timecop
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - ">="
200
214
  - !ruby/object:Gem::Version
201
- version: '0'
215
+ version: '0.8'
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - ">="
207
221
  - !ruby/object:Gem::Version
208
- version: '0'
222
+ version: '0.8'
209
223
  description: SAML IdP (Identity Provider) Library for Ruby
210
224
  email: jon.phenow@sportngin.com
211
225
  executables: []
@@ -215,9 +229,6 @@ files:
215
229
  - Gemfile
216
230
  - LICENSE
217
231
  - README.md
218
- - app/controllers/saml_idp/idp_controller.rb
219
- - app/views/saml_idp/idp/new.html.erb
220
- - app/views/saml_idp/idp/saml_post.html.erb
221
232
  - lib/saml_idp.rb
222
233
  - lib/saml_idp/algorithmable.rb
223
234
  - lib/saml_idp/assertion_builder.rb
@@ -228,6 +239,7 @@ files:
228
239
  - lib/saml_idp/default.rb
229
240
  - lib/saml_idp/encryptor.rb
230
241
  - lib/saml_idp/engine.rb
242
+ - lib/saml_idp/fingerprint.rb
231
243
  - lib/saml_idp/hashable.rb
232
244
  - lib/saml_idp/incoming_metadata.rb
233
245
  - lib/saml_idp/logout_builder.rb
@@ -254,6 +266,7 @@ files:
254
266
  - spec/lib/saml_idp/configurator_spec.rb
255
267
  - spec/lib/saml_idp/controller_spec.rb
256
268
  - spec/lib/saml_idp/encryptor_spec.rb
269
+ - spec/lib/saml_idp/fingerprint_spec.rb
257
270
  - spec/lib/saml_idp/incoming_metadata_spec.rb
258
271
  - spec/lib/saml_idp/logout_request_builder_spec.rb
259
272
  - spec/lib/saml_idp/logout_response_builder_spec.rb
@@ -279,6 +292,8 @@ files:
279
292
  - spec/rails_app/app/mailers/.gitkeep
280
293
  - spec/rails_app/app/models/.gitkeep
281
294
  - spec/rails_app/app/views/layouts/application.html.erb
295
+ - spec/rails_app/app/views/saml_idp/idp/new.html.erb
296
+ - spec/rails_app/app/views/saml_idp/idp/saml_post.html.erb
282
297
  - spec/rails_app/config.ru
283
298
  - spec/rails_app/config/application.rb
284
299
  - spec/rails_app/config/boot.rb
@@ -319,6 +334,9 @@ files:
319
334
  - spec/spec_helper.rb
320
335
  - spec/support/certificates/certificate1
321
336
  - spec/support/certificates/r1_certificate2_base64
337
+ - spec/support/certificates/sp_cert_req.csr
338
+ - spec/support/certificates/sp_private_key.pem
339
+ - spec/support/certificates/sp_x509_cert.crt
322
340
  - spec/support/responses/adfs_response_sha1.xml
323
341
  - spec/support/responses/adfs_response_sha256.xml
324
342
  - spec/support/responses/adfs_response_sha384.xml
@@ -347,22 +365,21 @@ metadata:
347
365
  homepage_uri: https://github.com/saml-idp/saml_idp
348
366
  source_code_uri: https://github.com/saml-idp/saml_idp
349
367
  bug_tracker_uri: https://github.com/saml-idp/saml_idp/issues
350
- documentation_uri: http://rdoc.info/gems/saml_idp/0.8.0
351
- post_install_message: |
352
- If you're just recently updating saml_idp - please be aware we've changed the default
353
- certificate. See the PR and a description of why we've done this here:
354
- https://github.com/saml-idp/saml_idp/pull/29
355
-
356
- If you just need to see the certificate `bundle open saml_idp` and go to
357
- `lib/saml_idp/default.rb`
368
+ documentation_uri: http://rdoc.info/gems/saml_idp/0.15.0
369
+ post_install_message: |2
370
+ If you're just recently updating saml_idp - please be aware we've changed the default
371
+ certificate. See the PR and a description of why we've done this here:
372
+ https://github.com/saml-idp/saml_idp/pull/29
358
373
 
359
- Similarly, please see the README about certificates - you should avoid using the
360
- defaults in a Production environment. Post any issues you to github.
374
+ If you just need to see the certificate `bundle open saml_idp` and go to
375
+ `lib/saml_idp/default.rb`
361
376
 
362
- ** New in Version 0.3.0 **
377
+ Similarly, please see the README about certificates - you should avoid using the
378
+ defaults in a Production environment. Post any issues you to github.
363
379
 
364
- Encrypted Assertions require the xmlenc gem. See the example in the Controller
365
- section of the README.
380
+ ** New in Version 0.3.0 **
381
+ Encrypted Assertions require the xmlenc gem. See the example in the Controller
382
+ section of the README.
366
383
  rdoc_options:
367
384
  - "--charset=UTF-8"
368
385
  require_paths:
@@ -371,16 +388,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
388
  requirements:
372
389
  - - ">="
373
390
  - !ruby/object:Gem::Version
374
- version: '2.2'
391
+ version: '2.5'
375
392
  required_rubygems_version: !ruby/object:Gem::Requirement
376
393
  requirements:
377
394
  - - ">="
378
395
  - !ruby/object:Gem::Version
379
396
  version: '0'
380
397
  requirements: []
381
- rubyforge_project:
382
- rubygems_version: 2.7.6
383
- signing_key:
398
+ rubygems_version: 3.3.7
399
+ signing_key:
384
400
  specification_version: 4
385
401
  summary: SAML Indentity Provider for Ruby
386
402
  test_files:
@@ -392,6 +408,7 @@ test_files:
392
408
  - spec/lib/saml_idp/configurator_spec.rb
393
409
  - spec/lib/saml_idp/controller_spec.rb
394
410
  - spec/lib/saml_idp/encryptor_spec.rb
411
+ - spec/lib/saml_idp/fingerprint_spec.rb
395
412
  - spec/lib/saml_idp/incoming_metadata_spec.rb
396
413
  - spec/lib/saml_idp/logout_request_builder_spec.rb
397
414
  - spec/lib/saml_idp/logout_response_builder_spec.rb
@@ -417,6 +434,8 @@ test_files:
417
434
  - spec/rails_app/app/mailers/.gitkeep
418
435
  - spec/rails_app/app/models/.gitkeep
419
436
  - spec/rails_app/app/views/layouts/application.html.erb
437
+ - spec/rails_app/app/views/saml_idp/idp/new.html.erb
438
+ - spec/rails_app/app/views/saml_idp/idp/saml_post.html.erb
420
439
  - spec/rails_app/config.ru
421
440
  - spec/rails_app/config/application.rb
422
441
  - spec/rails_app/config/boot.rb
@@ -457,6 +476,9 @@ test_files:
457
476
  - spec/spec_helper.rb
458
477
  - spec/support/certificates/certificate1
459
478
  - spec/support/certificates/r1_certificate2_base64
479
+ - spec/support/certificates/sp_cert_req.csr
480
+ - spec/support/certificates/sp_private_key.pem
481
+ - spec/support/certificates/sp_x509_cert.crt
460
482
  - spec/support/responses/adfs_response_sha1.xml
461
483
  - spec/support/responses/adfs_response_sha256.xml
462
484
  - spec/support/responses/adfs_response_sha384.xml
@@ -1,59 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module SamlIdp
4
- class IdpController < ActionController::Base
5
- include SamlIdp::Controller
6
-
7
- unloadable unless Rails::VERSION::MAJOR >= 4
8
- protect_from_forgery
9
-
10
- if Rails::VERSION::MAJOR >= 4
11
- before_action :validate_saml_request, only: [:new, :create]
12
- else
13
- before_filter :validate_saml_request, only: [:new, :create]
14
- end
15
-
16
- def new
17
- render template: "saml_idp/idp/new"
18
- end
19
-
20
- def show
21
- render xml: SamlIdp.metadata.signed
22
- end
23
-
24
- def create
25
- unless params[:email].blank? && params[:password].blank?
26
- person = idp_authenticate(params[:email], params[:password])
27
- if person.nil?
28
- @saml_idp_fail_msg = "Incorrect email or password."
29
- else
30
- @saml_response = idp_make_saml_response(person)
31
- render :template => "saml_idp/idp/saml_post", :layout => false
32
- return
33
- end
34
- end
35
- render :template => "saml_idp/idp/new"
36
- end
37
-
38
- def logout
39
- idp_logout
40
- @saml_response = idp_make_saml_response(nil)
41
- render :template => "saml_idp/idp/saml_post", :layout => false
42
- end
43
-
44
- def idp_logout
45
- raise NotImplementedError
46
- end
47
- private :idp_logout
48
-
49
- def idp_authenticate(email, password)
50
- raise NotImplementedError
51
- end
52
- protected :idp_authenticate
53
-
54
- def idp_make_saml_response(person)
55
- raise NotImplementedError
56
- end
57
- protected :idp_make_saml_response
58
- end
59
- end