Class: HashAuth::Strategies::Base
- Inherits:
-
Object
- Object
- HashAuth::Strategies::Base
- Defined in:
- lib/hash-auth/strategies/base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.acquire_string_to_hash(controller, client) ⇒ Object
upon receiving a hashed request, extract the string that needs to be hashed and compared to the signature passed.
-
.hash_string(client, string) ⇒ Object
how the querystring should be hashed (eg. hmac-sha1, md5).
-
.identifier ⇒ Object
provide the HashAuth system with a handle for this strategy.
-
.on_authentication(client, controller) ⇒ Object
anything special that needs to be done upon successful authentication of a request (eg. log in proxy user for a given client).
-
.on_failure(client, controller, type) ⇒ Object
on_failure is triggered during the before_filter of an action that requires hash authentication if any of the cases are met (these are the options for type): - :no_matching_client - :invalid_domain - :invalid_hash.
-
.sign_request(client, verb, params) ⇒ Object
sign_request should sign the outgoing request.
-
.verify_hash(target_string, client, controller) ⇒ Object
determine equality of the target string, as calculated by acquire_string_to_hash -> hash_string, with the actual signature passed by client.
Class Method Details
.acquire_string_to_hash(controller, client) ⇒ Object
upon receiving a hashed request, extract the string that needs to be hashed and compared to the signature passed
12 13 14 |
# File 'lib/hash-auth/strategies/base.rb', line 12 def self.acquire_string_to_hash(controller, client) raise "acquire_string_to_hash method not implemented in #{self.class.name}" end |
.hash_string(client, string) ⇒ Object
how the querystring should be hashed (eg. hmac-sha1, md5)
17 18 19 |
# File 'lib/hash-auth/strategies/base.rb', line 17 def self.hash_string(client, string) raise "hash_string method not implemented in #{self.class.name}" end |
.identifier ⇒ Object
provide the HashAuth system with a handle for this strategy
7 8 9 |
# File 'lib/hash-auth/strategies/base.rb', line 7 def self.identifier raise "identifier method not implemented in #{self.class.name}" end |
.on_authentication(client, controller) ⇒ Object
anything special that needs to be done upon successful authentication of a request (eg. log in proxy user for a given client)
27 28 29 |
# File 'lib/hash-auth/strategies/base.rb', line 27 def self.on_authentication(client, controller) raise "on_authentication method not implemented in #{self.class.name}" end |
.on_failure(client, controller, type) ⇒ Object
on_failure is triggered during the before_filter of an action that requires hash authentication if any of the cases are met (these are the options for type):
- :no_matching_client
- :invalid_domain
- :invalid_hash
36 37 38 |
# File 'lib/hash-auth/strategies/base.rb', line 36 def self.on_failure(client, controller, type) raise "on_failure method not implemented in #{self.class.name}" end |
.sign_request(client, verb, params) ⇒ Object
sign_request should sign the outgoing request. Given the different objects available at request creation time versus receipt time, this method needs to be included in addition to acquire_string_to_hash
42 43 44 |
# File 'lib/hash-auth/strategies/base.rb', line 42 def self.sign_request(client, verb, params) raise "sign_request method not implemented in #{self.class.name}" end |
.verify_hash(target_string, client, controller) ⇒ Object
determine equality of the target string, as calculated by acquire_string_to_hash -> hash_string, with the actual signature passed by client
22 23 24 |
# File 'lib/hash-auth/strategies/base.rb', line 22 def self.verify_hash(target_string, client, controller) raise "verify_hash method not implemented in #{self.class.name}" end |