casino 1.3.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +3 -0
  3. data/.travis.yml +1 -1
  4. data/README.md +1 -8
  5. data/Rakefile +0 -2
  6. data/app/assets/javascripts/casino/application.js +1 -0
  7. data/app/assets/javascripts/casino/index.js +0 -2
  8. data/app/assets/javascripts/casino/sessions.js +32 -0
  9. data/app/authenticators/casino/static_authenticator.rb +23 -0
  10. data/app/builders/casino/ticket_validation_response_builder.rb +84 -0
  11. data/app/controllers/casino/api/v1/tickets_controller.rb +7 -4
  12. data/app/controllers/casino/application_controller.rb +2 -3
  13. data/{lib/casino/listener/legacy_validator.rb → app/listeners/casino/legacy_validator_listener.rb} +2 -2
  14. data/app/listeners/casino/listener.rb +16 -0
  15. data/{lib/casino/listener/login_credential_acceptor.rb → app/listeners/casino/login_credential_acceptor_listener.rb} +2 -2
  16. data/{lib/casino/listener/login_credential_requestor.rb → app/listeners/casino/login_credential_requestor_listener.rb} +2 -2
  17. data/{lib/casino/listener/logout.rb → app/listeners/casino/logout_listener.rb} +2 -2
  18. data/{lib/casino/listener/other_sessions_destroyer.rb → app/listeners/casino/other_sessions_destroyer_listener.rb} +2 -2
  19. data/{lib/casino/listener/proxy_ticket_provider.rb → app/listeners/casino/proxy_ticket_provider_listener.rb} +2 -2
  20. data/{lib/casino/listener/second_factor_authentication_acceptor.rb → app/listeners/casino/second_factor_authentication_acceptor_listener.rb} +2 -2
  21. data/{lib/casino/listener/session_destroyer.rb → app/listeners/casino/session_destroyer_listener.rb} +2 -2
  22. data/{lib/casino/listener/session_overview.rb → app/listeners/casino/session_overview_listener.rb} +2 -2
  23. data/{lib/casino/listener/ticket_validator.rb → app/listeners/casino/ticket_validator_listener.rb} +2 -2
  24. data/{lib/casino/listener/two_factor_authenticator_activator.rb → app/listeners/casino/two_factor_authenticator_activator_listener.rb} +2 -2
  25. data/{lib/casino/listener/two_factor_authenticator_destroyer.rb → app/listeners/casino/two_factor_authenticator_destroyer_listener.rb} +2 -2
  26. data/{lib/casino/listener/two_factor_authenticator_overview.rb → app/listeners/casino/two_factor_authenticator_overview_listener.rb} +2 -2
  27. data/{lib/casino/listener/two_factor_authenticator_registrator.rb → app/listeners/casino/two_factor_authenticator_registrator_listener.rb} +2 -2
  28. data/app/models/casino/login_ticket.rb +12 -0
  29. data/app/models/casino/proxy_granting_ticket.rb +8 -0
  30. data/app/models/casino/proxy_ticket.rb +25 -0
  31. data/app/models/casino/service_rule.rb +27 -0
  32. data/app/models/casino/service_ticket.rb +43 -0
  33. data/app/models/casino/service_ticket/single_sign_out_notifier.rb +44 -0
  34. data/app/models/casino/ticket_granting_ticket.rb +57 -0
  35. data/app/models/casino/two_factor_authenticator.rb +18 -0
  36. data/app/models/casino/user.rb +12 -0
  37. data/app/models/casino/validation_result.rb +5 -0
  38. data/app/processors/casino/api/login_credential_acceptor_processor.rb +46 -0
  39. data/app/processors/casino/api/logout_processor.rb +17 -0
  40. data/app/processors/casino/api/service_ticket_provider_processor.rb +69 -0
  41. data/app/processors/casino/legacy_validator_processor.rb +19 -0
  42. data/app/processors/casino/login_credential_acceptor_processor.rb +63 -0
  43. data/app/processors/casino/login_credential_requestor_processor.rb +66 -0
  44. data/app/processors/casino/logout_processor.rb +23 -0
  45. data/app/processors/casino/other_sessions_destroyer_processor.rb +26 -0
  46. data/app/processors/casino/processor.rb +5 -0
  47. data/app/processors/casino/processor_concern/authentication.rb +87 -0
  48. data/app/processors/casino/processor_concern/browser.rb +14 -0
  49. data/app/processors/casino/processor_concern/login_tickets.rb +28 -0
  50. data/app/processors/casino/processor_concern/proxy_granting_tickets.rb +43 -0
  51. data/app/processors/casino/processor_concern/proxy_tickets.rb +56 -0
  52. data/app/processors/casino/processor_concern/service_tickets.rb +50 -0
  53. data/app/processors/casino/processor_concern/ticket_granting_tickets.rb +65 -0
  54. data/app/processors/casino/processor_concern/tickets.rb +17 -0
  55. data/app/processors/casino/processor_concern/two_factor_authenticators.rb +22 -0
  56. data/app/processors/casino/proxy_ticket_provider_processor.rb +41 -0
  57. data/app/processors/casino/proxy_ticket_validator_processor.rb +22 -0
  58. data/app/processors/casino/second_factor_authentication_acceptor_processor.rb +45 -0
  59. data/app/processors/casino/service_ticket_validator_processor.rb +46 -0
  60. data/app/processors/casino/session_destroyer_processor.rb +25 -0
  61. data/app/processors/casino/session_overview_processor.rb +21 -0
  62. data/app/processors/casino/two_factor_authenticator_activator_processor.rb +41 -0
  63. data/app/processors/casino/two_factor_authenticator_destroyer_processor.rb +33 -0
  64. data/app/processors/casino/two_factor_authenticator_overview_processor.rb +20 -0
  65. data/app/processors/casino/two_factor_authenticator_registrator_processor.rb +24 -0
  66. data/app/views/casino/application/_footer.html.erb +1 -1
  67. data/app/views/casino/sessions/new.html.erb +2 -1
  68. data/app/views/casino/sessions/validate_otp.html.erb +1 -1
  69. data/app/views/casino/two_factor_authenticators/new.html.erb +2 -2
  70. data/app/views/layouts/application.html.erb +1 -1
  71. data/casino.gemspec +9 -4
  72. data/db/migrate/20130809135400_create_core_schema.rb +117 -0
  73. data/db/migrate/20130809135401_rename_base_models.rb +101 -0
  74. data/db/migrate/20131022110146_cleanup_indexes.rb +27 -0
  75. data/db/migrate/20131022110246_fix_long_index_names.rb +12 -0
  76. data/db/migrate/20131022110346_change_service_to_text.rb +6 -0
  77. data/lib/casino.rb +47 -3
  78. data/lib/casino/authenticator.rb +9 -0
  79. data/lib/casino/engine.rb +26 -0
  80. data/lib/casino/inflections.rb +7 -0
  81. data/lib/casino/tasks.rb +1 -0
  82. data/lib/casino/tasks/cleanup.rake +59 -0
  83. data/lib/casino/tasks/service_rule.rake +49 -0
  84. data/lib/casino/version.rb +1 -1
  85. data/lib/generators/casino/install/USAGE +13 -0
  86. data/lib/generators/casino/install/install_generator.rb +47 -0
  87. data/lib/generators/casino/{templates → install/templates}/README +3 -4
  88. data/lib/generators/casino/{templates → install/templates}/cas.yml +2 -2
  89. data/lib/generators/casino/{templates → install/templates}/casino_and_overrides.scss +0 -0
  90. data/lib/generators/casino/templates/casino_core.rb +1 -1
  91. data/spec/authenticator/base_spec.rb +13 -0
  92. data/spec/authenticator/static_spec.rb +42 -0
  93. data/spec/controllers/api/v1/tickets_controller_spec.rb +15 -15
  94. data/spec/controllers/listener/legacy_validator_spec.rb +1 -1
  95. data/spec/controllers/listener/login_credential_acceptor_spec.rb +1 -1
  96. data/spec/controllers/listener/login_credential_requestor_spec.rb +1 -1
  97. data/spec/controllers/listener/logout_spec.rb +1 -1
  98. data/spec/controllers/listener/other_sessions_destroyer_spec.rb +1 -1
  99. data/spec/controllers/listener/proxy_ticket_provider_spec.rb +1 -1
  100. data/spec/controllers/listener/second_factor_authentication_acceptor_spec.rb +1 -1
  101. data/spec/controllers/listener/session_destroyer_spec.rb +1 -1
  102. data/spec/controllers/listener/session_overview_spec.rb +1 -1
  103. data/spec/controllers/listener/ticket_validator_spec.rb +1 -1
  104. data/spec/controllers/listener/two_factor_authenticator_activator_spec.rb +1 -1
  105. data/spec/controllers/listener/two_factor_authenticator_destroyer_spec.rb +1 -1
  106. data/spec/controllers/listener/two_factor_authenticator_overview_spec.rb +1 -1
  107. data/spec/controllers/listener/two_factor_authenticator_registrator_spec.rb +1 -1
  108. data/spec/controllers/proxy_tickets_controller_spec.rb +4 -4
  109. data/spec/controllers/service_tickets_controller_spec.rb +4 -4
  110. data/spec/controllers/sessions_controller_spec.rb +15 -15
  111. data/spec/controllers/two_factor_authenticators_controller_spec.rb +6 -6
  112. data/spec/dummy/app/assets/stylesheets/casino_and_overrides.scss +13 -0
  113. data/spec/dummy/config/cas.yml +11 -11
  114. data/spec/dummy/config/routes.rb +1 -2
  115. data/spec/dummy/db/migrate/20130910094259_create_base_models.casino.rb +95 -0
  116. data/spec/dummy/db/schema.rb +107 -0
  117. data/spec/model/login_ticket_spec.rb +23 -0
  118. data/spec/model/proxy_ticket_spec.rb +63 -0
  119. data/spec/model/service_rule_spec.rb +65 -0
  120. data/spec/model/service_ticket/single_sign_out_notifier_spec.rb +61 -0
  121. data/spec/model/service_ticket_spec.rb +124 -0
  122. data/spec/model/ticket_granting_ticket_spec.rb +204 -0
  123. data/spec/model/two_factor_authenticator_spec.rb +31 -0
  124. data/spec/processor/api/login_credential_acceptor_spec.rb +52 -0
  125. data/spec/processor/api/logout_spec.rb +34 -0
  126. data/spec/processor/api/service_ticket_provider_spec.rb +61 -0
  127. data/spec/processor/legacy_validator_spec.rb +78 -0
  128. data/spec/processor/login_credential_acceptor_spec.rb +164 -0
  129. data/spec/processor/login_credential_requestor_spec.rb +135 -0
  130. data/spec/processor/logout_other_sessions_spec.rb +53 -0
  131. data/spec/processor/logout_spec.rb +72 -0
  132. data/spec/processor/processor_concern/service_tickets_spec.rb +49 -0
  133. data/spec/processor/proxy_ticket_provider_spec.rb +66 -0
  134. data/spec/processor/proxy_ticket_validator_spec.rb +65 -0
  135. data/spec/processor/second_factor_authenticaton_acceptor_spec.rb +94 -0
  136. data/spec/processor/session_destroyer_spec.rb +75 -0
  137. data/spec/processor/session_overview_spec.rb +49 -0
  138. data/spec/processor/ticket_validator_spec.rb +199 -0
  139. data/spec/processor/two_factor_authenticator_activator_spec.rb +122 -0
  140. data/spec/processor/two_factor_authenticator_destroyer_spec.rb +71 -0
  141. data/spec/processor/two_factor_authenticator_overview_spec.rb +56 -0
  142. data/spec/processor/two_factor_authenticator_registrator_spec.rb +48 -0
  143. data/spec/spec_helper.rb +8 -19
  144. data/spec/support/casino.rb +12 -0
  145. data/spec/support/factories/login_ticket_factory.rb +16 -0
  146. data/spec/support/factories/proxy_granting_ticket_factory.rb +16 -0
  147. data/spec/support/factories/proxy_ticket_factory.rb +17 -0
  148. data/spec/support/factories/service_rule_factory.rb +16 -0
  149. data/spec/support/factories/service_ticket_factory.rb +17 -0
  150. data/spec/support/factories/ticket_granting_ticket_factory.rb +15 -0
  151. data/spec/support/factories/two_factor_authenticator_factory.rb +16 -0
  152. data/spec/support/factories/user_factory.rb +11 -0
  153. data/spec/support/rspec.rb +8 -0
  154. data/spec/support/sqlite3.rb +4 -0
  155. metadata +284 -48
  156. metadata.gz.sig +2 -0
  157. data/.powrc +0 -4
  158. data/Gemfile.lock +0 -149
  159. data/app/assets/javascripts/casino/application.js.coffee +0 -5
  160. data/app/assets/javascripts/casino/sessions.js.coffee +0 -15
  161. data/config/initializers/frontend_config.rb +0 -9
  162. data/config/initializers/inflections.rb +0 -19
  163. data/config/initializers/yaml.rb +0 -1
  164. data/lib/casino/listener.rb +0 -31
  165. data/lib/generators/casino/install_generator.rb +0 -35
  166. data/spec/dummy/config/initializers/casino_core.rb +0 -1
@@ -2,18 +2,17 @@
2
2
 
3
3
  The CASino Engine has been correctly installed in your Rails application.
4
4
 
5
- 1. Edit the configuration files:
5
+ 1. Edit the configuration file:
6
6
 
7
7
  - config/cas.yml
8
- - config/database.yml
9
8
 
10
9
  2. Edit or delete (to use the integrated) layout file:
11
10
 
12
11
  - app/views/layouts/application.html.erb
13
12
 
14
- 3. Load the database schema
13
+ 3. Run the generated CASino migrations
15
14
 
16
- > bundle exec rake casino_core:db:schema:load
15
+ > bundle exec rake db:migrate SCOPE=casino
17
16
 
18
17
  4. Launch the server
19
18
 
@@ -15,7 +15,7 @@ development:
15
15
  <<: *defaults
16
16
  authenticators:
17
17
  static:
18
- class: "CASinoCore::Authenticator::Static"
18
+ class: "CASino::StaticAuthenticator"
19
19
  options:
20
20
  users:
21
21
  testuser:
@@ -25,7 +25,7 @@ test:
25
25
  <<: *defaults
26
26
  authenticators:
27
27
  static:
28
- class: "CASinoCore::Authenticator::Static"
28
+ class: "CASino::StaticAuthenticator"
29
29
  options:
30
30
  users:
31
31
  testuser:
@@ -1 +1 @@
1
- CASinoCore.setup Rails.env, application_root: Rails.root
1
+ CASino.setup Rails.env, application_root: Rails.root
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe CASino::Authenticator do
4
+ subject {
5
+ CASino::Authenticator.new
6
+ }
7
+
8
+ context '#validate' do
9
+ it 'raises an error' do
10
+ expect { subject.validate(nil, nil) }.to raise_error(NotImplementedError)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe CASino::StaticAuthenticator do
4
+ subject {
5
+ described_class.new({
6
+ users: {
7
+ user: {
8
+ password: 'testing123',
9
+ fullname: 'Example User'
10
+ }
11
+ }
12
+ })
13
+ }
14
+
15
+ context '#validate' do
16
+ context 'with invalid credentials' do
17
+ it 'returns false for an unknown username' do
18
+ subject.validate('foobar', 'test').should == false
19
+ end
20
+
21
+ it 'returns false for a known username with wrong password' do
22
+ subject.validate('user', 'test').should == false
23
+ end
24
+ end
25
+
26
+ context 'with valid credentials' do
27
+ let(:result) { subject.validate('user', 'testing123') }
28
+
29
+ it 'does not return false' do
30
+ result.should_not == false
31
+ end
32
+
33
+ it 'returns the username' do
34
+ result[:username].should == 'user'
35
+ end
36
+
37
+ it 'returns extra attributes' do
38
+ result[:extra_attributes][:fullname].should == 'Example User'
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::API::V1::TicketsController do
3
+ describe CASino::Api::V1::TicketsController do
4
4
 
5
5
  describe "POST /cas/v1/tickets" do
6
6
  context "with correct credentials" do
7
7
 
8
8
  before do
9
- CASinoCore::Processor::API::LoginCredentialAcceptor.any_instance.should_receive(:process) do
9
+ CASino::API::LoginCredentialAcceptorProcessor.any_instance.should_receive(:process) do
10
10
  @controller.user_logged_in_via_api "TGT-long-string"
11
11
  end
12
12
 
13
- post :create, params: {username: 'valid', password: 'valid'}
13
+ post :create, username: 'valid', password: 'valid', use_route: :casino
14
14
  end
15
15
 
16
16
  subject { response }
@@ -21,11 +21,11 @@ describe CASino::API::V1::TicketsController do
21
21
  context "with incorrect credentials" do
22
22
 
23
23
  before do
24
- CASinoCore::Processor::API::LoginCredentialAcceptor.any_instance.should_receive(:process) do
24
+ CASino::API::LoginCredentialAcceptorProcessor.any_instance.should_receive(:process) do
25
25
  @controller.invalid_login_credentials_via_api
26
26
  end
27
27
 
28
- post :create, params: {username: 'invalid', password: 'invalid'}
28
+ post :create, username: 'invalid', password: 'invalid', use_route: :casino
29
29
  end
30
30
 
31
31
  subject { response }
@@ -35,11 +35,11 @@ describe CASino::API::V1::TicketsController do
35
35
  context "with a not allowed service" do
36
36
 
37
37
  before do
38
- CASinoCore::Processor::API::LoginCredentialAcceptor.any_instance.should_receive(:process) do
38
+ CASino::API::LoginCredentialAcceptorProcessor.any_instance.should_receive(:process) do
39
39
  @controller.service_not_allowed_via_api
40
40
  end
41
41
 
42
- post :create, params: {username: 'example', password: 'example'}
42
+ post :create, username: 'example', password: 'example', use_route: :casino
43
43
  end
44
44
 
45
45
  subject { response }
@@ -52,11 +52,11 @@ describe CASino::API::V1::TicketsController do
52
52
  context "with a valid TGT" do
53
53
 
54
54
  before do
55
- CASinoCore::Processor::API::ServiceTicketProvider.any_instance.should_receive(:process).with('TGT-valid', kind_of(Hash), request.user_agent) do |ticket, params|
55
+ CASino::API::ServiceTicketProviderProcessor.any_instance.should_receive(:process).with('TGT-valid', kind_of(Hash), request.user_agent) do |ticket, params|
56
56
  params.should == controller.params
57
57
  @controller.granted_service_ticket_via_api 'ST-1-VALIDSERVICETICKET'
58
58
  end
59
- post :update, id: 'TGT-valid', service: 'http://example.org/'
59
+ post :update, id: 'TGT-valid', service: 'http://example.org/', use_route: :casino
60
60
  end
61
61
 
62
62
  subject { response }
@@ -68,11 +68,11 @@ describe CASino::API::V1::TicketsController do
68
68
  context "with an invalid TGT" do
69
69
 
70
70
  before do
71
- CASinoCore::Processor::API::ServiceTicketProvider.any_instance.should_receive(:process).with('TGT-invalid', kind_of(Hash), request.user_agent) do |ticket, params|
71
+ CASino::API::ServiceTicketProviderProcessor.any_instance.should_receive(:process).with('TGT-invalid', kind_of(Hash), request.user_agent) do |ticket, params|
72
72
  params.should == controller.params
73
73
  @controller.invalid_ticket_granting_ticket_via_api
74
74
  end
75
- post :update, id: 'TGT-invalid', service: 'http://example.org/'
75
+ post :update, id: 'TGT-invalid', service: 'http://example.org/', use_route: :casino
76
76
  end
77
77
 
78
78
  subject { response }
@@ -84,11 +84,11 @@ describe CASino::API::V1::TicketsController do
84
84
  context "without a service" do
85
85
 
86
86
  before do
87
- CASinoCore::Processor::API::ServiceTicketProvider.any_instance.should_receive(:process).with('TGT-valid', kind_of(Hash), request.user_agent) do |ticket, params|
87
+ CASino::API::ServiceTicketProviderProcessor.any_instance.should_receive(:process).with('TGT-valid', kind_of(Hash), request.user_agent) do |ticket, params|
88
88
  params.should == controller.params
89
89
  @controller.no_service_provided_via_api
90
90
  end
91
- post :update, id: 'TGT-valid'
91
+ post :update, id:'TGT-valid', use_route: :casino
92
92
  end
93
93
 
94
94
  subject { response }
@@ -100,10 +100,10 @@ describe CASino::API::V1::TicketsController do
100
100
 
101
101
  describe "DELETE /cas/v1/tickets/TGT-fdsjfsdfjkalfewrihfdhfaie" do
102
102
  before do
103
- CASinoCore::Processor::API::Logout.any_instance.should_receive(:process).with('TGT-fdsjfsdfjkalfewrihfdhfaie', request.user_agent) do
103
+ CASino::API::LogoutProcessor.any_instance.should_receive(:process).with('TGT-fdsjfsdfjkalfewrihfdhfaie', request.user_agent) do
104
104
  @controller.user_logged_out_via_api
105
105
  end
106
- post :destroy, id: 'TGT-fdsjfsdfjkalfewrihfdhfaie'
106
+ post :destroy, id: 'TGT-fdsjfsdfjkalfewrihfdhfaie', use_route: :casino
107
107
  end
108
108
 
109
109
  subject { response }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::LegacyValidator do
3
+ describe CASino::LegacyValidatorListener do
4
4
  let(:controller) { Object.new }
5
5
  let(:listener) { described_class.new(controller) }
6
6
  let(:response_text) { "foobar\nbla\n" }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::LoginCredentialAcceptor do
3
+ describe CASino::LoginCredentialAcceptorListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::LoginCredentialRequestor do
3
+ describe CASino::LoginCredentialRequestorListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::Logout do
3
+ describe CASino::LogoutListener do
4
4
  include Rails.application.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::OtherSessionsDestroyer do
3
+ describe CASino::OtherSessionsDestroyerListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::ProxyTicketProvider do
3
+ describe CASino::ProxyTicketProviderListener do
4
4
  let(:controller) { Object.new }
5
5
  let(:listener) { described_class.new(controller) }
6
6
  let(:xml) { "<foo><bar>bla</bar></foo>" }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::SecondFactorAuthenticationAcceptor do
3
+ describe CASino::SecondFactorAuthenticationAcceptorListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::SessionDestroyer do
3
+ describe CASino::SessionDestroyerListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::SessionOverview do
3
+ describe CASino::SessionOverviewListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Object.new }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::TicketValidator do
3
+ describe CASino::TicketValidatorListener do
4
4
  let(:controller) { Object.new }
5
5
  let(:listener) { described_class.new(controller) }
6
6
  let(:xml) { "<foo><bar>bla</bar></foo>" }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::TwoFactorAuthenticatorActivator do
3
+ describe CASino::TwoFactorAuthenticatorActivatorListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::TwoFactorAuthenticatorDestroyer do
3
+ describe CASino::TwoFactorAuthenticatorDestroyerListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::TwoFactorAuthenticatorOverview do
3
+ describe CASino::TwoFactorAuthenticatorOverviewListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CASino::Listener::TwoFactorAuthenticatorRegistrator do
3
+ describe CASino::TwoFactorAuthenticatorRegistratorListener do
4
4
  include CASino::Engine.routes.url_helpers
5
5
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
6
6
  let(:listener) { described_class.new(controller) }
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe CASino::ProxyTicketsController do
4
4
  describe 'GET "serviceValidate"' do
5
- let(:params) { { service: 'https://www.example.com/' } }
5
+ let(:params) { { service: 'https://www.example.com/', use_route: :casino } }
6
6
  it 'calls the process method of the ProxyTicketValidator' do
7
- CASinoCore::Processor::ProxyTicketValidator.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
7
+ CASino::ProxyTicketValidatorProcessor.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
8
8
  params.should == controller.params
9
9
  controller.render nothing: true
10
10
  end
@@ -13,9 +13,9 @@ describe CASino::ProxyTicketsController do
13
13
  end
14
14
 
15
15
  describe 'GET "proxy"' do
16
- let(:params) { { service: 'https://www.example.com/' } }
16
+ let(:params) { { service: 'https://www.example.com/', use_route: :casino } }
17
17
  it 'calls the process method of the ProxyTicketProvider' do
18
- CASinoCore::Processor::ProxyTicketProvider.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
18
+ CASino::ProxyTicketProviderProcessor.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
19
19
  params.should == controller.params
20
20
  controller.render nothing: true
21
21
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe CASino::ServiceTicketsController do
4
4
  describe 'GET "validate"' do
5
- let(:params) { { service: 'https://www.example.com/' } }
5
+ let(:params) { { service: 'https://www.example.com/', use_route: :casino } }
6
6
  it 'calls the process method of the LegacyValidator' do
7
- CASinoCore::Processor::LegacyValidator.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
7
+ CASino::LegacyValidatorProcessor.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
8
8
  params.should == controller.params
9
9
  controller.render nothing: true
10
10
  end
@@ -13,9 +13,9 @@ describe CASino::ServiceTicketsController do
13
13
  end
14
14
 
15
15
  describe 'GET "serviceValidate"' do
16
- let(:params) { { service: 'https://www.example.com/' } }
16
+ let(:params) { { service: 'https://www.example.com/', use_route: :casino } }
17
17
  it 'calls the process method of the LegacyValidator' do
18
- CASinoCore::Processor::ServiceTicketValidator.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
18
+ CASino::ServiceTicketValidatorProcessor.any_instance.should_receive(:process).with(kind_of(Hash)) do |params|
19
19
  params.should == controller.params
20
20
  controller.render nothing: true
21
21
  end
@@ -3,45 +3,45 @@ require 'spec_helper'
3
3
  describe CASino::SessionsController do
4
4
  describe 'GET "new"' do
5
5
  it 'calls the process method of the LoginCredentialRequestor' do
6
- CASinoCore::Processor::LoginCredentialRequestor.any_instance.should_receive(:process)
7
- get :new
6
+ CASino::LoginCredentialRequestorProcessor.any_instance.should_receive(:process)
7
+ get :new, use_route: :casino
8
8
  end
9
9
  end
10
10
 
11
11
  describe 'POST "create"' do
12
12
  it 'calls the process method of the LoginCredentialAcceptor' do
13
- CASinoCore::Processor::LoginCredentialAcceptor.any_instance.should_receive(:process) do
13
+ CASino::LoginCredentialAcceptorProcessor.any_instance.should_receive(:process) do
14
14
  @controller.render nothing: true
15
15
  end
16
- post :create
16
+ post :create, use_route: :casino
17
17
  end
18
18
  end
19
19
 
20
20
  describe 'POST "validate_otp"' do
21
21
  it 'calls the process method of the SecondFactorAuthenticatonAcceptor' do
22
- CASinoCore::Processor::SecondFactorAuthenticationAcceptor.any_instance.should_receive(:process) do
22
+ CASino::SecondFactorAuthenticationAcceptorProcessor.any_instance.should_receive(:process) do
23
23
  @controller.render nothing: true
24
24
  end
25
- post :validate_otp
25
+ post :validate_otp, use_route: :casino
26
26
  end
27
27
  end
28
28
 
29
29
  describe 'GET "logout"' do
30
30
  it 'calls the process method of the Logout processor' do
31
- CASinoCore::Processor::Logout.any_instance.should_receive(:process) do |params, cookies, user_agent|
31
+ CASino::LogoutProcessor.any_instance.should_receive(:process) do |params, cookies, user_agent|
32
32
  params.should == controller.params
33
33
  cookies.should == controller.cookies
34
34
  user_agent.should == request.user_agent
35
35
  end
36
- get :logout
36
+ get :logout, use_route: :casino
37
37
  end
38
38
  end
39
39
 
40
40
  describe 'GET "index"' do
41
41
  it 'calls the process method of the SessionOverview processor' do
42
- CASinoCore::Processor::TwoFactorAuthenticatorOverview.any_instance.should_receive(:process)
43
- CASinoCore::Processor::SessionOverview.any_instance.should_receive(:process)
44
- get :index
42
+ CASino::TwoFactorAuthenticatorOverviewProcessor.any_instance.should_receive(:process)
43
+ CASino::SessionOverviewProcessor.any_instance.should_receive(:process)
44
+ get :index, use_route: :casino
45
45
  end
46
46
  end
47
47
 
@@ -50,22 +50,22 @@ describe CASino::SessionsController do
50
50
  let(:tgt) { 'TGT-foobar' }
51
51
  it 'calls the process method of the SessionOverview processor' do
52
52
  request.cookies[:tgt] = tgt
53
- CASinoCore::Processor::SessionDestroyer.any_instance.should_receive(:process) do |params, cookies, user_agent|
53
+ CASino::SessionDestroyerProcessor.any_instance.should_receive(:process) do |params, cookies, user_agent|
54
54
  params[:id].should == id
55
55
  cookies[:tgt].should == tgt
56
56
  user_agent.should == request.user_agent
57
57
  @controller.render nothing: true
58
58
  end
59
- delete :destroy, id: id
59
+ delete :destroy, id:id, use_route: :casino
60
60
  end
61
61
  end
62
62
 
63
63
  describe 'GET "destroy_others"' do
64
64
  it 'calls the process method of the OtherSessionsDestroyer' do
65
- CASinoCore::Processor::OtherSessionsDestroyer.any_instance.should_receive(:process) do
65
+ CASino::OtherSessionsDestroyerProcessor.any_instance.should_receive(:process) do
66
66
  @controller.render nothing: true
67
67
  end
68
- get :destroy_others
68
+ get :destroy_others, use_route: :casino
69
69
  end
70
70
  end
71
71
  end