Skip to content

Commit 23e3852

Browse files
author
Robert Mitwicki
committed
Merge pull request #226 from davexunit/issue-225
Fix how SQLAuthLogic and SQLRestAuth fetch their user model class.
2 parents 73b89bb + 9bb8374 commit 23e3852

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

lib/casserver/authenticators/sql_authlogic.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ def validate(credentials)
4949
read_standard_credentials(credentials)
5050
raise_if_not_configured
5151

52-
user_model = self.class.user_model
53-
5452
username_column = @options[:username_column] || "login"
5553
password_column = @options[:password_column] || "crypted_password"
5654
salt_column = @options[:salt_column]

lib/casserver/authenticators/sql_encrypted.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ def generate_encryption_salt
4040

4141
def self.setup(options)
4242
super(options)
43-
user_models.each { |auth_index, model| model.__send__(:include, EncryptedPassword) }
43+
user_model = user_models[options[:auth_index]]
44+
user_model.__send__(:include, EncryptedPassword)
4445
end
4546

4647
def validate(credentials)
4748
read_standard_credentials(credentials)
4849
raise_if_not_configured
4950

50-
user_model = self.user_model
51-
5251
username_column = @options[:username_column] || "username"
5352
encrypt_function = @options[:encrypt_function] || 'user.encrypted_password == Digest::SHA256.hexdigest("#{user.encryption_salt}::#{@password}")'
5453

lib/casserver/authenticators/sql_rest_auth.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ def validate(credentials)
2727
raise CASServer::AuthenticatorError, "You must specify a 'site_key' in the SQLRestAuth authenticator's configuration!" unless @options[:site_key]
2828
raise CASServer::AuthenticatorError, "You must specify 'digest_streches' in the SQLRestAuth authenticator's configuration!" unless @options[:digest_streches]
2929

30-
user_model = self.class.user_model
31-
3230
username_column = @options[:username_column] || "email"
3331

3432
log_connection_pool_size
@@ -54,6 +52,7 @@ def validate(credentials)
5452

5553
def self.setup(options)
5654
super(options)
55+
user_model = user_models[options[:auth_index]]
5756
user_model.__send__(:include, EncryptedPassword)
5857
end
5958

0 commit comments

Comments
 (0)