X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/da94fc33ede86bf19fec91e6d5c2abeb8bbfd165..06a74fa86fe32b1ac89f2e77c4e2e408e061ecb5:/services/api/app/controllers/arvados/v1/healthcheck_controller.rb diff --git a/services/api/app/controllers/arvados/v1/healthcheck_controller.rb b/services/api/app/controllers/arvados/v1/healthcheck_controller.rb index e10b3936e1..c562082077 100644 --- a/services/api/app/controllers/arvados/v1/healthcheck_controller.rb +++ b/services/api/app/controllers/arvados/v1/healthcheck_controller.rb @@ -3,28 +3,29 @@ # SPDX-License-Identifier: AGPL-3.0 class Arvados::V1::HealthcheckController < ApplicationController - skip_before_filter :catch_redirect_hint - skip_before_filter :find_objects_for_index - skip_before_filter :find_object_by_uuid - skip_before_filter :load_filters_param - skip_before_filter :load_limit_offset_order_params - skip_before_filter :load_read_auths - skip_before_filter :load_where_param - skip_before_filter :render_404_if_no_object - skip_before_filter :require_auth_scope + skip_before_action :catch_redirect_hint + skip_before_action :find_objects_for_index + skip_before_action :find_object_by_uuid + skip_before_action :load_filters_param + skip_before_action :load_limit_offset_order_params + skip_before_action :load_select_param + skip_before_action :load_read_auths + skip_before_action :load_where_param + skip_before_action :render_404_if_no_object + skip_before_action :require_auth_scope - before_filter :check_auth_header + before_action :check_auth_header def check_auth_header - mgmt_token = Rails.configuration.management_token + mgmt_token = Rails.configuration.ManagementToken auth_header = request.headers['Authorization'] - if !mgmt_token - send_error("disabled", status: 404) + if mgmt_token == "" + send_json ({"errors" => "disabled"}), status: 404 elsif !auth_header - send_error("authorization required", status: 401) + send_json ({"errors" => "authorization required"}), status: 401 elsif auth_header != 'Bearer '+mgmt_token - send_error("authorization error", status: 403) + send_json ({"errors" => "authorization error"}), status: 403 end end