Module: Hawk::Client
Instance Method Summary collapse
- #authenticate(authorization_header, options) ⇒ Object
- #build_authorization_header(options) ⇒ Object
- #calculate_time_offset(authorization_header, options) ⇒ Object
Instance Method Details
#authenticate(authorization_header, options) ⇒ Object
7 8 9 |
# File 'lib/hawk/client.rb', line 7 def authenticate(, ) Hawk::AuthorizationHeader.authenticate(, { :server_response => true, :type => 'response' }.merge()) end |
#build_authorization_header(options) ⇒ Object
11 12 13 |
# File 'lib/hawk/client.rb', line 11 def () Hawk::AuthorizationHeader.build() end |
#calculate_time_offset(authorization_header, options) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/hawk/client.rb', line 15 def calculate_time_offset(, ) parts = AuthorizationHeader.parse() expected_mac = Crypto.ts_mac(:ts => parts[:ts], :credentials => [:credentials]) return unless expected_mac == parts[:tsm] parts[:ts].to_i - Time.now.to_i end |