protect_from_forgery
before_filter :uncamelcase_params_hash_keys
before_filter :find_object_by_uuid, :except => :index
+ before_filter :authenticate_api_token
unless Rails.application.config.consider_all_requests_local
rescue_from Exception,
}
render json: @object_list
end
+
+ def authenticate_api_token
+ unless Rails.configuration.
+ accept_api_token.
+ has_key?(params[:api_token] ||
+ cookies[:api_token])
+ render_error(Exception.new("Invalid API token"))
+ end
+ end
end
config.compute_node_nameservers = ['192.168.201.3']
config.uuid_prefix('development@' + `hostname`.strip)
+
+ # Authentication stub: hard code pre-approved API tokens.
+ # config.accept_api_token = { rand(2**256).to_s(36) => true }
+ config.accept_api_token = {}
end
end << '172.16.0.23'
config.uuid_prefix = Digest::MD5.hexdigest('cfi-aws-0').to_i(16).to_s(36)[0..4] # '9ujm1'
+
+ # Authentication stub: hard code pre-approved API tokens.
+ # config.accept_api_token = { rand(2**256).to_s(36) => true }
+ config.accept_api_token = {}
end
config.compute_node_nameservers = [ "172.16.0.23" ]
config.uuid_prefix('test@' + `hostname`.strip)
+
+ # Authentication stub: hard code pre-approved API tokens.
+ # config.accept_api_token = { rand(2**256).to_s(36) => true }
+ config.accept_api_token = {}
end