casino_core 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
- source 'http://rubygems.org'
1
+ source :rubygems
2
+
3
+ gemspec
4
+
2
5
  # Add dependencies required to use your gem here.
3
6
  # Example:
4
7
  # gem 'activesupport', '>= 2.3.5'
data/Gemfile.lock CHANGED
@@ -1,3 +1,11 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ casino_core (1.0.7)
5
+ activerecord (~> 3.2.9)
6
+ addressable (~> 2.3.2)
7
+ useragent (~> 0.4.13)
8
+
1
9
  GEM
2
10
  remote: http://rubygems.org/
3
11
  specs:
@@ -61,6 +69,7 @@ DEPENDENCIES
61
69
  activerecord (~> 3.2.9)
62
70
  addressable (~> 2.3.2)
63
71
  bundler (~> 1.2.0)
72
+ casino_core!
64
73
  database_cleaner
65
74
  factory_girl (~> 4.1.0)
66
75
  jeweler (~> 1.8.4)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.7
1
+ 1.0.8
data/casino_core.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "casino_core"
8
- s.version = "1.0.7"
8
+ s.version = "1.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nils Caspar"]
@@ -110,6 +110,7 @@ Gem::Specification.new do |s|
110
110
  "spec/processor/session_destroyer_spec.rb",
111
111
  "spec/processor/session_overview_spec.rb",
112
112
  "spec/processor/ticket_validator_spec.rb",
113
+ "spec/settings_spec.rb",
113
114
  "spec/spec_helper.rb",
114
115
  "spec/support/factories/login_ticket_factory.rb",
115
116
  "spec/support/factories/proxy_granting_ticket_factory.rb",
@@ -127,6 +128,7 @@ Gem::Specification.new do |s|
127
128
  s.specification_version = 3
128
129
 
129
130
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
131
+ s.add_runtime_dependency(%q<casino_core>, [">= 0"])
130
132
  s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.9"])
131
133
  s.add_runtime_dependency(%q<addressable>, ["~> 2.3.2"])
132
134
  s.add_runtime_dependency(%q<useragent>, ["~> 0.4.13"])
@@ -141,7 +143,19 @@ Gem::Specification.new do |s|
141
143
  s.add_development_dependency(%q<webmock>, [">= 0"])
142
144
  s.add_development_dependency(%q<nokogiri>, [">= 0"])
143
145
  s.add_development_dependency(%q<factory_girl>, ["~> 4.1.0"])
146
+ s.add_development_dependency(%q<bundler>, ["~> 1.2.0"])
147
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
148
+ s.add_development_dependency(%q<redcarpet>, [">= 0"])
149
+ s.add_development_dependency(%q<yard>, ["~> 0.8.3"])
150
+ s.add_development_dependency(%q<rspec>, ["~> 2.12.0"])
151
+ s.add_development_dependency(%q<simplecov>, ["~> 0.7.1"])
152
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
153
+ s.add_development_dependency(%q<database_cleaner>, [">= 0"])
154
+ s.add_development_dependency(%q<webmock>, [">= 0"])
155
+ s.add_development_dependency(%q<nokogiri>, [">= 0"])
156
+ s.add_development_dependency(%q<factory_girl>, ["~> 4.1.0"])
144
157
  else
158
+ s.add_dependency(%q<casino_core>, [">= 0"])
145
159
  s.add_dependency(%q<activerecord>, ["~> 3.2.9"])
146
160
  s.add_dependency(%q<addressable>, ["~> 2.3.2"])
147
161
  s.add_dependency(%q<useragent>, ["~> 0.4.13"])
@@ -156,8 +170,20 @@ Gem::Specification.new do |s|
156
170
  s.add_dependency(%q<webmock>, [">= 0"])
157
171
  s.add_dependency(%q<nokogiri>, [">= 0"])
158
172
  s.add_dependency(%q<factory_girl>, ["~> 4.1.0"])
173
+ s.add_dependency(%q<bundler>, ["~> 1.2.0"])
174
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
175
+ s.add_dependency(%q<redcarpet>, [">= 0"])
176
+ s.add_dependency(%q<yard>, ["~> 0.8.3"])
177
+ s.add_dependency(%q<rspec>, ["~> 2.12.0"])
178
+ s.add_dependency(%q<simplecov>, ["~> 0.7.1"])
179
+ s.add_dependency(%q<sqlite3>, [">= 0"])
180
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
181
+ s.add_dependency(%q<webmock>, [">= 0"])
182
+ s.add_dependency(%q<nokogiri>, [">= 0"])
183
+ s.add_dependency(%q<factory_girl>, ["~> 4.1.0"])
159
184
  end
160
185
  else
186
+ s.add_dependency(%q<casino_core>, [">= 0"])
161
187
  s.add_dependency(%q<activerecord>, ["~> 3.2.9"])
162
188
  s.add_dependency(%q<addressable>, ["~> 2.3.2"])
163
189
  s.add_dependency(%q<useragent>, ["~> 0.4.13"])
@@ -172,6 +198,17 @@ Gem::Specification.new do |s|
172
198
  s.add_dependency(%q<webmock>, [">= 0"])
173
199
  s.add_dependency(%q<nokogiri>, [">= 0"])
174
200
  s.add_dependency(%q<factory_girl>, ["~> 4.1.0"])
201
+ s.add_dependency(%q<bundler>, ["~> 1.2.0"])
202
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
203
+ s.add_dependency(%q<redcarpet>, [">= 0"])
204
+ s.add_dependency(%q<yard>, ["~> 0.8.3"])
205
+ s.add_dependency(%q<rspec>, ["~> 2.12.0"])
206
+ s.add_dependency(%q<simplecov>, ["~> 0.7.1"])
207
+ s.add_dependency(%q<sqlite3>, [">= 0"])
208
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
209
+ s.add_dependency(%q<webmock>, [">= 0"])
210
+ s.add_dependency(%q<nokogiri>, [">= 0"])
211
+ s.add_dependency(%q<factory_girl>, ["~> 4.1.0"])
175
212
  end
176
213
  end
177
214
 
@@ -20,11 +20,27 @@ module CASinoCore
20
20
  @authenticators = {}
21
21
  authenticators.each do |index, authenticator|
22
22
  unless authenticator.is_a?(CASinoCore::Authenticator)
23
- authenticator = authenticator[:class].constantize.new(authenticator[:options])
23
+ if authenticator[:class]
24
+ authenticator = authenticator[:class].constantize.new(authenticator[:options])
25
+ else
26
+ authenticator = load_and_instantiate_authenticator(authenticator[:authenticator], authenticator[:options])
27
+ end
24
28
  end
25
29
  @authenticators[index] = authenticator
26
30
  end
27
31
  end
32
+
33
+ private
34
+ def load_and_instantiate_authenticator(name, options)
35
+ gemname = "casino_core-authenticator-#{name.underscore}"
36
+ classname = name.classify
37
+ begin
38
+ require gemname
39
+ CASinoCore::Authenticator.const_get(classname).new(options)
40
+ rescue LoadError
41
+ raise LoadError, "Authenticator '#{name}' not found. Please include \"gem '#{gemname}'\" in your Gemfile and try again."
42
+ end
43
+ end
28
44
  end
29
45
  end
30
46
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe CASinoCore::Settings do
4
+ describe '#authenticators=' do
5
+ context 'with an authenticator name' do
6
+ let(:authenticator_name) { 'testing' }
7
+ let(:gem_name) { "casino_core-authenticator-#{authenticator_name}" }
8
+ let(:options) { { } }
9
+ let(:authenticators) {
10
+ {
11
+ test_1: {
12
+ authenticator: authenticator_name,
13
+ options: options
14
+ }
15
+ }
16
+ }
17
+
18
+ context 'when the authenticator exists' do
19
+ let(:class_name) { 'Testing' }
20
+ let(:authenticator) { CASinoCore::Authenticator::Static }
21
+
22
+ before(:each) do
23
+ CASinoCore::Settings.stub(:require)
24
+ CASinoCore::Authenticator.stub(:const_get).and_return(authenticator)
25
+ end
26
+
27
+ it 'loads the required file' do
28
+ CASinoCore::Settings.should_receive(:require).with(gem_name)
29
+ described_class.authenticators = authenticators
30
+ end
31
+
32
+ it 'instantiates the authenticator' do
33
+ CASinoCore::Authenticator.should_receive(:const_get).with(class_name).and_return(authenticator)
34
+ described_class.authenticators = authenticators
35
+ end
36
+ end
37
+
38
+ context 'when the authenticator does not exist' do
39
+ before(:each) do
40
+ CASinoCore::Settings.stub(:require) do
41
+ raise LoadError, 'cannot load such file'
42
+ end
43
+ end
44
+
45
+ it 'raises an error' do
46
+ lambda {
47
+ described_class.authenticators = authenticators
48
+ }.should raise_error(LoadError)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
data/spec/spec_helper.rb CHANGED
@@ -36,15 +36,15 @@ RSpec.configure do |config|
36
36
  # --seed 1234
37
37
  config.order = 'random'
38
38
 
39
- CASinoCore.setup 'test'
40
- CASinoCore::Settings.logger.level = ::Logger::Severity::UNKNOWN
41
39
 
42
40
  config.before(:suite) do
43
41
  DatabaseCleaner.strategy = :transaction
44
- DatabaseCleaner.clean_with(:truncation)
45
42
  end
46
43
 
47
44
  config.before(:each) do
45
+ CASinoCore.setup 'test'
46
+ CASinoCore::Settings.logger.level = ::Logger::Severity::UNKNOWN
47
+ DatabaseCleaner.clean_with(:truncation)
48
48
  DatabaseCleaner.start
49
49
  end
50
50
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: casino_core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.7
5
+ version: 1.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nils Caspar
@@ -13,8 +13,19 @@ cert_chain: []
13
13
  date: 2013-01-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: activerecord
16
+ name: casino_core
17
17
  requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: activerecord
28
+ requirement: &id002 !ruby/object:Gem::Requirement
18
29
  none: false
19
30
  requirements:
20
31
  - - ~>
@@ -22,10 +33,10 @@ dependencies:
22
33
  version: 3.2.9
23
34
  type: :runtime
24
35
  prerelease: false
25
- version_requirements: *id001
36
+ version_requirements: *id002
26
37
  - !ruby/object:Gem::Dependency
27
38
  name: addressable
28
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirement: &id003 !ruby/object:Gem::Requirement
29
40
  none: false
30
41
  requirements:
31
42
  - - ~>
@@ -33,10 +44,10 @@ dependencies:
33
44
  version: 2.3.2
34
45
  type: :runtime
35
46
  prerelease: false
36
- version_requirements: *id002
47
+ version_requirements: *id003
37
48
  - !ruby/object:Gem::Dependency
38
49
  name: useragent
39
- requirement: &id003 !ruby/object:Gem::Requirement
50
+ requirement: &id004 !ruby/object:Gem::Requirement
40
51
  none: false
41
52
  requirements:
42
53
  - - ~>
@@ -44,10 +55,10 @@ dependencies:
44
55
  version: 0.4.13
45
56
  type: :runtime
46
57
  prerelease: false
47
- version_requirements: *id003
58
+ version_requirements: *id004
48
59
  - !ruby/object:Gem::Dependency
49
60
  name: bundler
50
- requirement: &id004 !ruby/object:Gem::Requirement
61
+ requirement: &id005 !ruby/object:Gem::Requirement
51
62
  none: false
52
63
  requirements:
53
64
  - - ~>
@@ -55,10 +66,10 @@ dependencies:
55
66
  version: 1.2.0
56
67
  type: :development
57
68
  prerelease: false
58
- version_requirements: *id004
69
+ version_requirements: *id005
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: jeweler
61
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirement: &id006 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ~>
@@ -66,10 +77,10 @@ dependencies:
66
77
  version: 1.8.4
67
78
  type: :development
68
79
  prerelease: false
69
- version_requirements: *id005
80
+ version_requirements: *id006
70
81
  - !ruby/object:Gem::Dependency
71
82
  name: redcarpet
72
- requirement: &id006 !ruby/object:Gem::Requirement
83
+ requirement: &id007 !ruby/object:Gem::Requirement
73
84
  none: false
74
85
  requirements:
75
86
  - - ">="
@@ -77,10 +88,10 @@ dependencies:
77
88
  version: "0"
78
89
  type: :development
79
90
  prerelease: false
80
- version_requirements: *id006
91
+ version_requirements: *id007
81
92
  - !ruby/object:Gem::Dependency
82
93
  name: yard
83
- requirement: &id007 !ruby/object:Gem::Requirement
94
+ requirement: &id008 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ~>
@@ -88,10 +99,10 @@ dependencies:
88
99
  version: 0.8.3
89
100
  type: :development
90
101
  prerelease: false
91
- version_requirements: *id007
102
+ version_requirements: *id008
92
103
  - !ruby/object:Gem::Dependency
93
104
  name: rspec
94
- requirement: &id008 !ruby/object:Gem::Requirement
105
+ requirement: &id009 !ruby/object:Gem::Requirement
95
106
  none: false
96
107
  requirements:
97
108
  - - ~>
@@ -99,10 +110,10 @@ dependencies:
99
110
  version: 2.12.0
100
111
  type: :development
101
112
  prerelease: false
102
- version_requirements: *id008
113
+ version_requirements: *id009
103
114
  - !ruby/object:Gem::Dependency
104
115
  name: simplecov
105
- requirement: &id009 !ruby/object:Gem::Requirement
116
+ requirement: &id010 !ruby/object:Gem::Requirement
106
117
  none: false
107
118
  requirements:
108
119
  - - ~>
@@ -110,10 +121,10 @@ dependencies:
110
121
  version: 0.7.1
111
122
  type: :development
112
123
  prerelease: false
113
- version_requirements: *id009
124
+ version_requirements: *id010
114
125
  - !ruby/object:Gem::Dependency
115
126
  name: sqlite3
116
- requirement: &id010 !ruby/object:Gem::Requirement
127
+ requirement: &id011 !ruby/object:Gem::Requirement
117
128
  none: false
118
129
  requirements:
119
130
  - - ">="
@@ -121,10 +132,10 @@ dependencies:
121
132
  version: "0"
122
133
  type: :development
123
134
  prerelease: false
124
- version_requirements: *id010
135
+ version_requirements: *id011
125
136
  - !ruby/object:Gem::Dependency
126
137
  name: database_cleaner
127
- requirement: &id011 !ruby/object:Gem::Requirement
138
+ requirement: &id012 !ruby/object:Gem::Requirement
128
139
  none: false
129
140
  requirements:
130
141
  - - ">="
@@ -132,10 +143,10 @@ dependencies:
132
143
  version: "0"
133
144
  type: :development
134
145
  prerelease: false
135
- version_requirements: *id011
146
+ version_requirements: *id012
136
147
  - !ruby/object:Gem::Dependency
137
148
  name: webmock
138
- requirement: &id012 !ruby/object:Gem::Requirement
149
+ requirement: &id013 !ruby/object:Gem::Requirement
139
150
  none: false
140
151
  requirements:
141
152
  - - ">="
@@ -143,10 +154,10 @@ dependencies:
143
154
  version: "0"
144
155
  type: :development
145
156
  prerelease: false
146
- version_requirements: *id012
157
+ version_requirements: *id013
147
158
  - !ruby/object:Gem::Dependency
148
159
  name: nokogiri
149
- requirement: &id013 !ruby/object:Gem::Requirement
160
+ requirement: &id014 !ruby/object:Gem::Requirement
150
161
  none: false
151
162
  requirements:
152
163
  - - ">="
@@ -154,10 +165,10 @@ dependencies:
154
165
  version: "0"
155
166
  type: :development
156
167
  prerelease: false
157
- version_requirements: *id013
168
+ version_requirements: *id014
158
169
  - !ruby/object:Gem::Dependency
159
170
  name: factory_girl
160
- requirement: &id014 !ruby/object:Gem::Requirement
171
+ requirement: &id015 !ruby/object:Gem::Requirement
161
172
  none: false
162
173
  requirements:
163
174
  - - ~>
@@ -165,7 +176,128 @@ dependencies:
165
176
  version: 4.1.0
166
177
  type: :development
167
178
  prerelease: false
168
- version_requirements: *id014
179
+ version_requirements: *id015
180
+ - !ruby/object:Gem::Dependency
181
+ name: bundler
182
+ requirement: &id016 !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ~>
186
+ - !ruby/object:Gem::Version
187
+ version: 1.2.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: *id016
191
+ - !ruby/object:Gem::Dependency
192
+ name: jeweler
193
+ requirement: &id017 !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ~>
197
+ - !ruby/object:Gem::Version
198
+ version: 1.8.4
199
+ type: :development
200
+ prerelease: false
201
+ version_requirements: *id017
202
+ - !ruby/object:Gem::Dependency
203
+ name: redcarpet
204
+ requirement: &id018 !ruby/object:Gem::Requirement
205
+ none: false
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: "0"
210
+ type: :development
211
+ prerelease: false
212
+ version_requirements: *id018
213
+ - !ruby/object:Gem::Dependency
214
+ name: yard
215
+ requirement: &id019 !ruby/object:Gem::Requirement
216
+ none: false
217
+ requirements:
218
+ - - ~>
219
+ - !ruby/object:Gem::Version
220
+ version: 0.8.3
221
+ type: :development
222
+ prerelease: false
223
+ version_requirements: *id019
224
+ - !ruby/object:Gem::Dependency
225
+ name: rspec
226
+ requirement: &id020 !ruby/object:Gem::Requirement
227
+ none: false
228
+ requirements:
229
+ - - ~>
230
+ - !ruby/object:Gem::Version
231
+ version: 2.12.0
232
+ type: :development
233
+ prerelease: false
234
+ version_requirements: *id020
235
+ - !ruby/object:Gem::Dependency
236
+ name: simplecov
237
+ requirement: &id021 !ruby/object:Gem::Requirement
238
+ none: false
239
+ requirements:
240
+ - - ~>
241
+ - !ruby/object:Gem::Version
242
+ version: 0.7.1
243
+ type: :development
244
+ prerelease: false
245
+ version_requirements: *id021
246
+ - !ruby/object:Gem::Dependency
247
+ name: sqlite3
248
+ requirement: &id022 !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ version: "0"
254
+ type: :development
255
+ prerelease: false
256
+ version_requirements: *id022
257
+ - !ruby/object:Gem::Dependency
258
+ name: database_cleaner
259
+ requirement: &id023 !ruby/object:Gem::Requirement
260
+ none: false
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: "0"
265
+ type: :development
266
+ prerelease: false
267
+ version_requirements: *id023
268
+ - !ruby/object:Gem::Dependency
269
+ name: webmock
270
+ requirement: &id024 !ruby/object:Gem::Requirement
271
+ none: false
272
+ requirements:
273
+ - - ">="
274
+ - !ruby/object:Gem::Version
275
+ version: "0"
276
+ type: :development
277
+ prerelease: false
278
+ version_requirements: *id024
279
+ - !ruby/object:Gem::Dependency
280
+ name: nokogiri
281
+ requirement: &id025 !ruby/object:Gem::Requirement
282
+ none: false
283
+ requirements:
284
+ - - ">="
285
+ - !ruby/object:Gem::Version
286
+ version: "0"
287
+ type: :development
288
+ prerelease: false
289
+ version_requirements: *id025
290
+ - !ruby/object:Gem::Dependency
291
+ name: factory_girl
292
+ requirement: &id026 !ruby/object:Gem::Requirement
293
+ none: false
294
+ requirements:
295
+ - - ~>
296
+ - !ruby/object:Gem::Version
297
+ version: 4.1.0
298
+ type: :development
299
+ prerelease: false
300
+ version_requirements: *id026
169
301
  description: A CAS server core library.
170
302
  email: ncaspar@me.com
171
303
  executables: []
@@ -269,6 +401,7 @@ files:
269
401
  - spec/processor/session_destroyer_spec.rb
270
402
  - spec/processor/session_overview_spec.rb
271
403
  - spec/processor/ticket_validator_spec.rb
404
+ - spec/settings_spec.rb
272
405
  - spec/spec_helper.rb
273
406
  - spec/support/factories/login_ticket_factory.rb
274
407
  - spec/support/factories/proxy_granting_ticket_factory.rb
@@ -288,7 +421,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
421
  requirements:
289
422
  - - ">="
290
423
  - !ruby/object:Gem::Version
291
- hash: 903042986350696611
424
+ hash: 2416459327114914315
292
425
  segments:
293
426
  - 0
294
427
  version: "0"