2012-03-07 55 views
0
resource = RestClient::Resource.new('http://protected/resource', 'user', 'pass') 

我已經看到上述鏈接,當我serchng http基本認證與紅寶石。但我的問題是如何檢索和解碼這個用戶,並通過登錄的目的?其餘的http基本授權與紅寶石

+0

對不起,什麼? 「檢索並解碼」用戶名和密碼?如果您沒有用戶名和密碼,那麼您不應該首先訪問受保護的資源......?! – deceze 2012-03-07 07:22:23

回答

1

如果你打算用Rails實現服務器端,http_basic_authenticate_with就是你要找的。見ActionController::HttpAuthentication::Basic

+0

我已經像這樣通過= RestClient :: Resource.new show_url,:user => user_name,:password => password – amtest 2012-08-12 16:32:34