Module: CASServer::Authenticators::SQLRestAuth::EncryptedPassword

Defined in:
lib/casserver/authenticators/sql_rest_auth.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



62
63
64
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 62

def self.included(mod)
  raise "#{self} should be inclued in an ActiveRecord class!" unless mod.respond_to?(:before_save)
end

Instance Method Details

#encrypt(password, site_key, digest_streches) ⇒ Object



66
67
68
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 66

def encrypt(password,site_key,digest_streches)
  password_digest(password, self.salt,site_key,digest_streches)
end

#password_digest(password, salt, site_key, digest_streches) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 74

def password_digest(password, salt,site_key,digest_streches)
  digest = site_key
  digest_streches.times do
    digest = secure_digest(digest, salt, password, site_key) 
  end
  digest
end

#secure_digest(*args) ⇒ Object



70
71
72
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 70

def secure_digest(*args)
  Digest::SHA1.hexdigest(args.flatten.join('--'))
end