Parent

Methods

Class/Module Index [+]

Quicksearch

ChefZero::Endpoints::AuthenticateUserEndpoint

/authenticate_user

Public Instance Methods

post(request) click to toggle source
# File lib/chef_zero/endpoints/authenticate_user_endpoint.rb, line 8
def post(request)
  request_json = JSON.parse(request.body, :create_additions => false)
  name = request_json['name']
  password = request_json['password']
  begin
    user = data_store.get(['users', name])
    verified = JSON.parse(user, :create_additions => false)['password'] == password
  rescue DataStore::DataNotFoundError
    verified = false
  end
  json_response(200, {
    'name' => name,
    'verified' => !!verified
  })
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.