Module: CASServer::Authenticators::SQLRestAuth::EncryptedPassword
- Included in:
- CASUser
- Defined in:
- lib/casserver/authenticators/sql_rest_auth.rb
Constant Summary collapse
- REST_AUTH_DIGEST_STRETCHES =
XXX: this constants MUST be defined in config. For more details # look at restful-authentication docs.
$CONF.rest_auth_digest_streches
- REST_AUTH_SITE_KEY =
$CONF.rest_auth_site_key
Class Method Summary collapse
Instance Method Summary collapse
- #encrypt(password) ⇒ Object
- #password_digest(password, salt) ⇒ Object
- #secure_digest(*args) ⇒ Object
Class Method Details
.included(mod) ⇒ Object
53 54 55 |
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 53 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) ⇒ Object
57 58 59 |
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 57 def encrypt(password) password_digest(password, self.salt) end |
#password_digest(password, salt) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 65 def password_digest(password, salt) digest = REST_AUTH_SITE_KEY REST_AUTH_DIGEST_STRETCHES.times do digest = secure_digest(digest, salt, password, REST_AUTH_SITE_KEY) end digest end |
#secure_digest(*args) ⇒ Object
61 62 63 |
# File 'lib/casserver/authenticators/sql_rest_auth.rb', line 61 def secure_digest(*args) Digest::SHA1.hexdigest(args.flatten.join('--')) end |