ruby-saml-idp 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/README.md +1 -1
  2. data/app/views/saml_idp/idp/saml_post.html.erb +5 -2
  3. data/lib/ruby-saml-idp.rb +5 -5
  4. data/lib/{saml-idp → saml_idp}/configurator.rb +2 -1
  5. data/lib/{saml-idp → saml_idp}/controller.rb +32 -8
  6. data/lib/{saml-idp → saml_idp}/default.rb +0 -0
  7. data/lib/{saml-idp → saml_idp}/engine.rb +0 -0
  8. data/lib/{saml-idp → saml_idp}/version.rb +1 -1
  9. data/ruby-saml-idp.gemspec +3 -1
  10. data/spec/acceptance/acceptance_helper.rb +9 -0
  11. data/spec/acceptance/idp_controller_spec.rb +16 -0
  12. data/spec/rails_app/.gitignore +15 -0
  13. data/spec/rails_app/README.rdoc +261 -0
  14. data/spec/rails_app/Rakefile +7 -0
  15. data/spec/rails_app/app/assets/images/rails.png +0 -0
  16. data/spec/rails_app/app/assets/javascripts/application.js +15 -0
  17. data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
  18. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  19. data/spec/rails_app/app/controllers/saml_controller.rb +8 -0
  20. data/spec/rails_app/app/controllers/saml_idp_controller.rb +11 -0
  21. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  22. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  23. data/spec/rails_app/app/models/.gitkeep +0 -0
  24. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  25. data/spec/rails_app/config.ru +4 -0
  26. data/spec/rails_app/config/application.rb +60 -0
  27. data/spec/rails_app/config/boot.rb +6 -0
  28. data/spec/rails_app/config/database.yml +25 -0
  29. data/spec/rails_app/config/environment.rb +5 -0
  30. data/spec/rails_app/config/environments/development.rb +37 -0
  31. data/spec/rails_app/config/environments/production.rb +67 -0
  32. data/spec/rails_app/config/environments/test.rb +37 -0
  33. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  34. data/spec/rails_app/config/initializers/inflections.rb +15 -0
  35. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  36. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  37. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  38. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  39. data/spec/rails_app/config/locales/en.yml +5 -0
  40. data/spec/rails_app/config/routes.rb +6 -0
  41. data/spec/rails_app/db/seeds.rb +7 -0
  42. data/spec/rails_app/doc/README_FOR_APP +2 -0
  43. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  44. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  45. data/spec/rails_app/log/.gitkeep +0 -0
  46. data/spec/rails_app/public/404.html +26 -0
  47. data/spec/rails_app/public/422.html +26 -0
  48. data/spec/rails_app/public/500.html +25 -0
  49. data/spec/rails_app/public/favicon.ico +0 -0
  50. data/spec/rails_app/public/index.html +241 -0
  51. data/spec/rails_app/public/robots.txt +5 -0
  52. data/spec/rails_app/script/rails +6 -0
  53. data/spec/rails_app/test/fixtures/.gitkeep +0 -0
  54. data/spec/rails_app/test/functional/.gitkeep +0 -0
  55. data/spec/rails_app/test/integration/.gitkeep +0 -0
  56. data/spec/rails_app/test/performance/browsing_test.rb +12 -0
  57. data/spec/rails_app/test/test_helper.rb +13 -0
  58. data/spec/rails_app/test/unit/.gitkeep +0 -0
  59. data/spec/rails_app/vendor/assets/javascripts/.gitkeep +0 -0
  60. data/spec/rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
  61. data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
  62. data/spec/saml_idp/controller_spec.rb +60 -0
  63. data/spec/spec_helper.rb +12 -2
  64. data/spec/support/saml_request_macros.rb +19 -0
  65. metadata +147 -12
  66. data/spec/controller_spec.rb +0 -49
data/spec/spec_helper.rb CHANGED
@@ -4,11 +4,21 @@ $LOAD_PATH.unshift File.dirname(__FILE__)
4
4
 
5
5
  STDERR.puts("Running Specs under Ruby Version #{RUBY_VERSION}")
6
6
 
7
+ require "rails_app/config/environment"
8
+
7
9
  require 'rspec'
10
+ require 'capybara/rspec'
11
+ require 'capybara/rails'
12
+
8
13
  require 'ruby-saml'
9
14
  require 'ruby-saml-idp'
10
15
 
11
- RSpec.configure do |c|
12
- c.mock_with :rspec
16
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
17
+
18
+ RSpec.configure do |config|
19
+ config.mock_with :rspec
20
+ config.include SamlRequestMacros
13
21
  end
14
22
 
23
+ Capybara.default_host = "https://app.example.com"
24
+
@@ -0,0 +1,19 @@
1
+ module SamlRequestMacros
2
+
3
+ def make_saml_request(requested_saml_acs_url = "https://foo.example.com/saml/consume")
4
+ auth_request = Onelogin::Saml::Authrequest.new
5
+ auth_url = auth_request.create(saml_settings(requested_saml_acs_url))
6
+ CGI.unescape(auth_url.split("=").last)
7
+ end
8
+
9
+ def saml_settings(saml_acs_url = "https://foo.example.com/saml/consume")
10
+ settings = Onelogin::Saml::Settings.new
11
+ settings.assertion_consumer_service_url = saml_acs_url
12
+ settings.issuer = "http://example.com/issuer"
13
+ settings.idp_sso_target_url = "http://idp.com/saml/idp"
14
+ settings.idp_cert_fingerprint = SamlIdp::Default::FINGERPRINT
15
+ settings.name_identifier_format = SamlIdp::Default::NAME_ID_FORMAT
16
+ settings
17
+ end
18
+
19
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-saml-idp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 6
10
- version: 0.2.6
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lawrence Pit
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-28 00:00:00 Z
18
+ date: 2012-04-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: uuid
@@ -73,6 +73,35 @@ dependencies:
73
73
  version: "0"
74
74
  type: :development
75
75
  version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: rails
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ~>
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 3
87
+ - 2
88
+ version: "3.2"
89
+ type: :development
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: capybara
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id006
76
105
  description: SAML IdP (Identity Provider) library in ruby
77
106
  email: lawrence.pit@gmail.com
78
107
  executables: []
@@ -86,17 +115,70 @@ files:
86
115
  - app/views/saml_idp/idp/new.html.erb
87
116
  - app/views/saml_idp/idp/saml_post.html.erb
88
117
  - lib/ruby-saml-idp.rb
89
- - lib/saml-idp/configurator.rb
90
- - lib/saml-idp/controller.rb
91
- - lib/saml-idp/default.rb
92
- - lib/saml-idp/engine.rb
93
- - lib/saml-idp/version.rb
118
+ - lib/saml_idp/configurator.rb
119
+ - lib/saml_idp/controller.rb
120
+ - lib/saml_idp/default.rb
121
+ - lib/saml_idp/engine.rb
122
+ - lib/saml_idp/version.rb
94
123
  - MIT-LICENSE
95
124
  - README.md
96
125
  - Gemfile
97
126
  - ruby-saml-idp.gemspec
98
- - spec/controller_spec.rb
127
+ - spec/acceptance/acceptance_helper.rb
128
+ - spec/acceptance/idp_controller_spec.rb
129
+ - spec/rails_app/.gitignore
130
+ - spec/rails_app/README.rdoc
131
+ - spec/rails_app/Rakefile
132
+ - spec/rails_app/app/assets/images/rails.png
133
+ - spec/rails_app/app/assets/javascripts/application.js
134
+ - spec/rails_app/app/assets/stylesheets/application.css
135
+ - spec/rails_app/app/controllers/application_controller.rb
136
+ - spec/rails_app/app/controllers/saml_controller.rb
137
+ - spec/rails_app/app/controllers/saml_idp_controller.rb
138
+ - spec/rails_app/app/helpers/application_helper.rb
139
+ - spec/rails_app/app/mailers/.gitkeep
140
+ - spec/rails_app/app/models/.gitkeep
141
+ - spec/rails_app/app/views/layouts/application.html.erb
142
+ - spec/rails_app/config.ru
143
+ - spec/rails_app/config/application.rb
144
+ - spec/rails_app/config/boot.rb
145
+ - spec/rails_app/config/database.yml
146
+ - spec/rails_app/config/environment.rb
147
+ - spec/rails_app/config/environments/development.rb
148
+ - spec/rails_app/config/environments/production.rb
149
+ - spec/rails_app/config/environments/test.rb
150
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
151
+ - spec/rails_app/config/initializers/inflections.rb
152
+ - spec/rails_app/config/initializers/mime_types.rb
153
+ - spec/rails_app/config/initializers/secret_token.rb
154
+ - spec/rails_app/config/initializers/session_store.rb
155
+ - spec/rails_app/config/initializers/wrap_parameters.rb
156
+ - spec/rails_app/config/locales/en.yml
157
+ - spec/rails_app/config/routes.rb
158
+ - spec/rails_app/db/seeds.rb
159
+ - spec/rails_app/doc/README_FOR_APP
160
+ - spec/rails_app/lib/assets/.gitkeep
161
+ - spec/rails_app/lib/tasks/.gitkeep
162
+ - spec/rails_app/log/.gitkeep
163
+ - spec/rails_app/public/404.html
164
+ - spec/rails_app/public/422.html
165
+ - spec/rails_app/public/500.html
166
+ - spec/rails_app/public/favicon.ico
167
+ - spec/rails_app/public/index.html
168
+ - spec/rails_app/public/robots.txt
169
+ - spec/rails_app/script/rails
170
+ - spec/rails_app/test/fixtures/.gitkeep
171
+ - spec/rails_app/test/functional/.gitkeep
172
+ - spec/rails_app/test/integration/.gitkeep
173
+ - spec/rails_app/test/performance/browsing_test.rb
174
+ - spec/rails_app/test/test_helper.rb
175
+ - spec/rails_app/test/unit/.gitkeep
176
+ - spec/rails_app/vendor/assets/javascripts/.gitkeep
177
+ - spec/rails_app/vendor/assets/stylesheets/.gitkeep
178
+ - spec/rails_app/vendor/plugins/.gitkeep
179
+ - spec/saml_idp/controller_spec.rb
99
180
  - spec/spec_helper.rb
181
+ - spec/support/saml_request_macros.rb
100
182
  homepage: http://github.com/lawrencepit/ruby-saml-idp
101
183
  licenses: []
102
184
 
@@ -131,5 +213,58 @@ signing_key:
131
213
  specification_version: 3
132
214
  summary: SAML Indentity Provider in ruby
133
215
  test_files:
134
- - spec/controller_spec.rb
216
+ - spec/acceptance/acceptance_helper.rb
217
+ - spec/acceptance/idp_controller_spec.rb
218
+ - spec/rails_app/.gitignore
219
+ - spec/rails_app/README.rdoc
220
+ - spec/rails_app/Rakefile
221
+ - spec/rails_app/app/assets/images/rails.png
222
+ - spec/rails_app/app/assets/javascripts/application.js
223
+ - spec/rails_app/app/assets/stylesheets/application.css
224
+ - spec/rails_app/app/controllers/application_controller.rb
225
+ - spec/rails_app/app/controllers/saml_controller.rb
226
+ - spec/rails_app/app/controllers/saml_idp_controller.rb
227
+ - spec/rails_app/app/helpers/application_helper.rb
228
+ - spec/rails_app/app/mailers/.gitkeep
229
+ - spec/rails_app/app/models/.gitkeep
230
+ - spec/rails_app/app/views/layouts/application.html.erb
231
+ - spec/rails_app/config.ru
232
+ - spec/rails_app/config/application.rb
233
+ - spec/rails_app/config/boot.rb
234
+ - spec/rails_app/config/database.yml
235
+ - spec/rails_app/config/environment.rb
236
+ - spec/rails_app/config/environments/development.rb
237
+ - spec/rails_app/config/environments/production.rb
238
+ - spec/rails_app/config/environments/test.rb
239
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
240
+ - spec/rails_app/config/initializers/inflections.rb
241
+ - spec/rails_app/config/initializers/mime_types.rb
242
+ - spec/rails_app/config/initializers/secret_token.rb
243
+ - spec/rails_app/config/initializers/session_store.rb
244
+ - spec/rails_app/config/initializers/wrap_parameters.rb
245
+ - spec/rails_app/config/locales/en.yml
246
+ - spec/rails_app/config/routes.rb
247
+ - spec/rails_app/db/seeds.rb
248
+ - spec/rails_app/doc/README_FOR_APP
249
+ - spec/rails_app/lib/assets/.gitkeep
250
+ - spec/rails_app/lib/tasks/.gitkeep
251
+ - spec/rails_app/log/.gitkeep
252
+ - spec/rails_app/public/404.html
253
+ - spec/rails_app/public/422.html
254
+ - spec/rails_app/public/500.html
255
+ - spec/rails_app/public/favicon.ico
256
+ - spec/rails_app/public/index.html
257
+ - spec/rails_app/public/robots.txt
258
+ - spec/rails_app/script/rails
259
+ - spec/rails_app/test/fixtures/.gitkeep
260
+ - spec/rails_app/test/functional/.gitkeep
261
+ - spec/rails_app/test/integration/.gitkeep
262
+ - spec/rails_app/test/performance/browsing_test.rb
263
+ - spec/rails_app/test/test_helper.rb
264
+ - spec/rails_app/test/unit/.gitkeep
265
+ - spec/rails_app/vendor/assets/javascripts/.gitkeep
266
+ - spec/rails_app/vendor/assets/stylesheets/.gitkeep
267
+ - spec/rails_app/vendor/plugins/.gitkeep
268
+ - spec/saml_idp/controller_spec.rb
135
269
  - spec/spec_helper.rb
270
+ - spec/support/saml_request_macros.rb
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe SamlIdp::Controller do
5
- include SamlIdp::Controller
6
-
7
- def params
8
- @params ||= {}
9
- end
10
-
11
- it "should find the SAML ACS URL" do
12
- requested_saml_acs_url = "https://foo.example.com/saml/consume"
13
- auth_request = Onelogin::Saml::Authrequest.new
14
- auth_url = auth_request.create(saml_settings(requested_saml_acs_url))
15
- params[:SAMLRequest] = CGI.unescape(auth_url.split("=").last)
16
-
17
- validate_saml_request
18
- saml_acs_url.should == requested_saml_acs_url
19
- end
20
-
21
- it "should create a SAML Response" do
22
- requested_saml_acs_url = "https://foo.example.com/saml/consume"
23
- saml_config = saml_settings(requested_saml_acs_url)
24
- auth_request = Onelogin::Saml::Authrequest.new
25
- auth_url = auth_request.create(saml_config)
26
- params[:SAMLRequest] = CGI.unescape(auth_url.split("=").last)
27
- validate_saml_request
28
- saml_response = encode_SAMLResponse("foo@example.com")
29
-
30
- response = Onelogin::Saml::Response.new(saml_response)
31
- response.name_id.should == "foo@example.com"
32
- response.issuer.should == "http://example.com"
33
- response.settings = saml_config
34
- response.is_valid?.should be_true
35
- end
36
-
37
- private
38
-
39
- def saml_settings(saml_acs_url)
40
- settings = Onelogin::Saml::Settings.new
41
- settings.assertion_consumer_service_url = saml_acs_url
42
- settings.issuer = "http://example.com/issuer"
43
- settings.idp_sso_target_url = "http://idp.com/saml/idp"
44
- settings.idp_cert_fingerprint = SamlIdp::Default::FINGERPRINT
45
- settings.name_identifier_format = SamlIdp::Default::NAME_ID_FORMAT
46
- settings
47
- end
48
-
49
- end