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.

Methods

Attributes

join_token  [W] 
stretches  [W] 

Public Class methods

This is for "old style" authentication with a custom format of digest

[Source]

    # 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

[Source]

    # 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.

[Source]

    # 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

[Source]

    # File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 10
10:         def join_token
11:           @join_token ||= "--"
12:         end

Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.

[Source]

    # File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 53
53:         def matches?(crypted, *tokens)
54:           encrypt(*tokens) == crypted
55:         end

The number of times to loop through the encryption. This is ten because that is what restful_authentication defaults to.

[Source]

    # File lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb, line 33
33:         def stretches
34:           @stretches ||= 10
35:         end

[Validate]