Skip to content

Commit 1755c0d

Browse files
author
Robert Mitwicki
committed
Merge pull request #234 from viranch/viranch/fix_multi_auth
Fix bug #233 with multiple authenticators
2 parents f3cab9e + 6a6ddd5 commit 1755c0d

1 file changed

Lines changed: 10 additions & 23 deletions

File tree

lib/casserver/server.rb

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,35 +189,22 @@ def self.init_authenticators!
189189
exit 1
190190
end
191191

192-
begin
193-
# attempt to instantiate the authenticator
194-
config[:authenticator] = [config[:authenticator]] unless config[:authenticator].instance_of? Array
195-
config[:authenticator].each { |authenticator| auth << authenticator[:class].constantize}
196-
rescue NameError
197-
if config[:authenticator].instance_of? Array
198-
config[:authenticator].each do |authenticator|
199-
if !authenticator[:source].nil?
200-
# config.yml explicitly names source file
201-
require authenticator[:source]
202-
else
203-
# the authenticator class hasn't yet been loaded, so lets try to load it from the casserver/authenticators directory
204-
auth_rb = authenticator[:class].underscore.gsub('cas_server/', '')
205-
require 'casserver/'+auth_rb
206-
end
207-
auth << authenticator[:class].constantize
208-
end
209-
else
210-
if config[:authenticator][:source]
192+
config[:authenticator] = [config[:authenticator]] unless config[:authenticator].instance_of? Array
193+
config[:authenticator].each do |authenticator|
194+
begin
195+
# attempt to instantiate the authenticator
196+
auth << authenticator[:class].constantize
197+
rescue NameError
198+
if authenticator[:source]
211199
# config.yml explicitly names source file
212-
require config[:authenticator][:source]
200+
require authenticator[:source]
213201
else
214202
# the authenticator class hasn't yet been loaded, so lets try to load it from the casserver/authenticators directory
215-
auth_rb = config[:authenticator][:class].underscore.gsub('cas_server/', '')
203+
auth_rb = authenticator[:class].underscore.gsub('cas_server/', '')
216204
require 'casserver/'+auth_rb
217205
end
218206

219-
auth << config[:authenticator][:class].constantize
220-
config[:authenticator] = [config[:authenticator]]
207+
auth << authenticator[:class].constantize
221208
end
222209
end
223210

0 commit comments

Comments
 (0)