Class: TentD::API::AuthenticationFinalize

Inherits:
Middleware
  • Object
show all
Defined in:
lib/tentd/api/authentication_finalize.rb

Instance Method Summary collapse

Methods inherited from Middleware

#call, #initialize

Methods included from Authorizable

#authorize_env!, #authorize_env?

Constructor Details

This class inherits a constructor from TentD::API::Middleware

Instance Method Details

#action(env) ⇒ Object



4
5
6
7
8
9
# File 'lib/tentd/api/authentication_finalize.rb', line 4

def action(env)
  return env unless env.hmac? && env.hmac.verified
  env.current_auth = env.potential_auth
  env.current_auth.update(:mac_timestamp_delta => Time.now.to_i - env.hmac.ts.to_i) unless env.current_auth.mac_timestamp_delta
  env
end