Class: Angus::Authentication::DefaultAuthenticator
- Inherits:
-
Object
- Object
- Angus::Authentication::DefaultAuthenticator
- Defined in:
- lib/angus/authentication/default_authenticator.rb
Instance Method Summary collapse
- #call(session_id, auth_data, auth_token) ⇒ Object
-
#initialize(private_key) ⇒ DefaultAuthenticator
constructor
A new instance of DefaultAuthenticator.
Constructor Details
#initialize(private_key) ⇒ DefaultAuthenticator
Returns a new instance of DefaultAuthenticator.
5 6 7 |
# File 'lib/angus/authentication/default_authenticator.rb', line 5 def initialize(private_key) @private_key = private_key end |
Instance Method Details
#call(session_id, auth_data, auth_token) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/angus/authentication/default_authenticator.rb', line 9 def call(session_id, auth_data, auth_token) if Digest::SHA1.hexdigest("#@private_key\n#{auth_data}") == auth_token private_session_key_seed = BCrypt::Engine.generate_salt private_session_key = Digest::SHA1.hexdigest( "#@private_key\n#{private_session_key_seed}" ) return private_session_key, private_session_key_seed else return nil, nil end end |