Class | Authlogic::CryptoProviders::Sha1 |
In: |
lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb
|
Parent: | Object |
This class was made for the users transitioning from restful_authentication. I highly discourage using this crypto provider as it inferior to your other options. Please use any other provider offered by Authlogic.
join_token | [W] | |
stretches | [W] |
This is for "old style" authentication with a custom format of digest
# File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 20 20: def digest(tokens) 21: if @digest_format 22: @digest_format. 23: gsub('PASSWORD', tokens.first). 24: gsub('SALT', tokens.last) 25: else 26: tokens.join(join_token) 27: end 28: end
# File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 15 15: def digest_format=(format) 16: @digest_format = format 17: end
Turns your raw password into a Sha1 hash.
# File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 39 39: def encrypt(*tokens) 40: tokens = tokens.flatten 41: 42: if stretches > 1 43: hash = tokens.shift 44: stretches.times { hash = Digest::SHA1.hexdigest([hash, *tokens].join(join_token)) } 45: else 46: hash = Digest::SHA1.hexdigest( digest(tokens) ) 47: end 48: 49: hash 50: end
# File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 10 10: def join_token 11: @join_token ||= "--" 12: end