Class: Hawk::AuthenticationFailure

Inherits:
Object
  • Object
show all
Defined in:
lib/hawk/authentication_failure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, message, options = {}) ⇒ AuthenticationFailure

Returns a new instance of AuthenticationFailure.



4
5
6
# File 'lib/hawk/authentication_failure.rb', line 4

def initialize(key, message, options = {})
  @key, @message, @options = key, message, options
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/hawk/authentication_failure.rb', line 3

def key
  @key
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/hawk/authentication_failure.rb', line 3

def message
  @message
end

Instance Method Details

#headerObject



8
9
10
11
12
13
14
15
16
# File 'lib/hawk/authentication_failure.rb', line 8

def header
  timestamp = Time.now.to_i
  if @options[:credentials]
    timestamp_mac = Crypto.ts_mac(:ts => timestamp, :credentials => @options[:credentials])
    %(Hawk ts="#{timestamp}", tsm="#{timestamp_mac}", error="#{message}")
  else
    %(Hawk error="#{message}")
  end
end