मैं बाकी ग्राहक का उपयोग कर एक आरईएसटी सेवा (एचपी एएलएम 11 आरईएसटी एपीआई एफडब्ल्यूवी) के लिए अनुरोध पोस्ट करने का प्रयास कर रहा हूं और अनधिकृत प्रतिक्रिया प्राप्त कर रहा हूं। हो सकता है कि मैं दस्तावेज़ों का सही पालन नहीं कर रहा हूं लेकिन मुझे यकीन नहीं है कि मैं हेडर सही तरीके से कर रहा हूं। अब तक RestClient के लिए मेरे googling फलहीन रहा है। किसी भी मदद की सराहना की जाएगी:मैं RestClient के साथ रेल मूलभूत प्रमाणीकरण कैसे करूं?
कोड:
@alm_url = "http://alm_url/qcbin/"
@user_name = "username"
@user_password = "password"
authentication_url = @alm_url + "rest/is-authenticate"
resource = RestClient::Resource.new authentication_url, {:user => @user_name, :password => @user_password}
response = resource.get
#response = RestClient.get authentication_url, :authorization => @username, @user_password
Rails.logger.debug response.inspect
प्रलेखन::
ग्राहक एक वैध भेजता
@alm_url = "http://alm_url/qcbin/" @user_name = "username" @user_password = "password" authentication_url = @alm_url + "rest/is-authenticate" resource = RestClient::Resource.new authentication_url resource.head :Authorization => Base64.encode64(@user_name) + ":" + Base64.encode64(@user_password) response = resource.get #response = RestClient.get authentication_url, :authorization => @username, @user_password Rails.logger.debug response.inspect
इस SO question के आधार पर मैं यह भी सफलता के बिना निम्नलिखित की कोशिश की प्रमाणीकरण बिंदु पर मूल प्रमाणीकरण शीर्षलेख।
प्राप्त/qcbin/प्रमाणीकरण सूत्री/प्रमाणित प्राधिकरण: बेसिक ABCDE123
सर्वर मूल प्रमाणीकरण हेडर सत्यापित करता है, एक नया LW-एसएसओ टोकन बनाता है और LWSSO_COOKIE_KEY के रूप में यह देता है।
authentication_url = @alm_url + "rest/is-authenticate"
कौन सा पढ़ना चाहिए: