Method: JunglePath::API::Helpers::AuthLocalUser#authenticate

Defined in:
lib/jungle_path/api/helpers/auth_local_user.rb

#authenticate(no_cache = false) ⇒ Object

If you are using this module, make sure your user table has these columns:

id,
user_name,
phone,
sms_verification_code,
hash,
key,
role


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jungle_path/api/helpers/auth_local_user.rb', line 20

def authenticate no_cache=false
  puts "AuthLocalUser.authenticate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
  remote_user = request.env['REMOTE_USER']
  remote_password = request.env['REMOTE_PASSWORD']
  puts "remote_user: #{remote_user}."
  puts "remote_password: #{remote_password}."
  is_authenticated = basic_authentication(remote_user, remote_password, no_cache)
  unless is_authenticated
    # force no_cache = true
    halt 401 unless basic_authentication(remote_user, remote_password, true)
  end
  #puts "content-type: #{request.content_type}."
  request.body.rewind
  #puts "body:\n#{request.body.read}."
  #puts "params:\n#{params}."
end