saml_idp 0.9.0 → 0.14.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -45
  3. data/lib/saml_idp.rb +2 -1
  4. data/lib/saml_idp/assertion_builder.rb +28 -3
  5. data/lib/saml_idp/configurator.rb +4 -1
  6. data/lib/saml_idp/controller.rb +11 -9
  7. data/lib/saml_idp/encryptor.rb +0 -1
  8. data/lib/saml_idp/fingerprint.rb +19 -0
  9. data/lib/saml_idp/incoming_metadata.rb +13 -0
  10. data/lib/saml_idp/metadata_builder.rb +23 -8
  11. data/lib/saml_idp/persisted_metadata.rb +4 -0
  12. data/lib/saml_idp/request.rb +9 -3
  13. data/lib/saml_idp/response_builder.rb +19 -5
  14. data/lib/saml_idp/saml_response.rb +37 -16
  15. data/lib/saml_idp/service_provider.rb +1 -6
  16. data/lib/saml_idp/signable.rb +1 -2
  17. data/lib/saml_idp/version.rb +1 -1
  18. data/saml_idp.gemspec +8 -8
  19. data/spec/lib/saml_idp/assertion_builder_spec.rb +73 -0
  20. data/spec/lib/saml_idp/configurator_spec.rb +1 -0
  21. data/spec/lib/saml_idp/controller_spec.rb +24 -0
  22. data/spec/lib/saml_idp/fingerprint_spec.rb +14 -0
  23. data/spec/lib/saml_idp/incoming_metadata_spec.rb +15 -1
  24. data/spec/lib/saml_idp/metadata_builder_spec.rb +23 -0
  25. data/spec/lib/saml_idp/response_builder_spec.rb +3 -1
  26. data/spec/lib/saml_idp/saml_response_spec.rb +25 -2
  27. data/spec/rails_app/app/controllers/saml_controller.rb +1 -5
  28. data/spec/rails_app/app/controllers/saml_idp_controller.rb +47 -8
  29. data/{app → spec/rails_app/app}/views/saml_idp/idp/new.html.erb +1 -5
  30. data/{app → spec/rails_app/app}/views/saml_idp/idp/saml_post.html.erb +1 -1
  31. data/spec/rails_app/config/environments/development.rb +2 -0
  32. data/spec/spec_helper.rb +20 -1
  33. data/spec/support/certificates/sp_cert_req.csr +12 -0
  34. data/spec/support/certificates/sp_private_key.pem +16 -0
  35. data/spec/support/certificates/sp_x509_cert.crt +18 -0
  36. data/spec/support/saml_request_macros.rb +62 -3
  37. data/spec/support/security_helpers.rb +10 -0
  38. metadata +51 -28
  39. data/app/controllers/saml_idp/idp_controller.rb +0 -59
@@ -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