【问题标题】:fog-openstack The request you have made requires authenticationfog-openstack 您发出的请求需要身份验证
【发布时间】:2017-10-01 18:15:35
【问题描述】:

我收到此错误:

Expected([201]) <=> Actual(401 Unauthorized) excon.error.response :body => "{\"error\": {\"message\": \"The request you have made requires authentication.\", \"code\": 401, \"title\": \"Unauthorized\"}}" :cookies => [ ] :headers => { "Cache-Control" => "no-cache, no-store, must-revalidate" "Content-Length" => "114" "Content-Security-Policy" => "default-src 'self'" "Content-Type" => "application/json" "Date" => "Sun, 01 Oct 2017 18:02:00 GMT" "Expires" => "0" "Pragma" => "no-cache" "Server" => "Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5" "Strict-Transport-Security" => "max-age=31536000" "Vary" => "X-Auth-Token" "WWW-Authenticate" => "Keystone uri=\"https://identity.open.softlayer.com\"" "X-Content-Type-Options" => "nosniff" "X-XSS-Protection" => "0" "x-openstack-request-id" => "req-2bef9760-51da-41d5-9c0f-a5fd6815ebae" } :host => "identity.open.softlayer.com" :local_address => "192.168.1.105" :local_port => 59391 :path => "/v3/auth/tokens" :port => 443 :reason_phrase => "Unauthorized" :remote_ip => "184.173.131.10" :status => 401 :status_line => "HTTP/1.1 401 Unauthorized\r\n"

这就是痕迹:

excon (0.59.0) lib/excon/middlewares/expects.rb:7:in `response_call'
excon (0.59.0) lib/excon/middlewares/response_parser.rb:9:in `response_call'
excon (0.59.0) lib/excon/connection.rb:389:in `response'
excon (0.59.0) lib/excon/connection.rb:253:in `request'
fog-core (1.45.0) lib/fog/core/connection.rb:81:in `request'
C:/Ruby24/lib/ruby/gems/2.4.0/bundler/gems/fog-openstack-3d5f4ea27a41/lib/fog/openstack.rb:527:in `retrieve_tokens_v3'
C:/Ruby24/lib/ruby/gems/2.4.0/bundler/gems/fog-openstack-3d5f4ea27a41/lib/fog/openstack.rb:275:in `authenticate_v3'
C:/Ruby24/lib/ruby/gems/2.4.0/bundler/gems/fog-openstack-3d5f4ea27a41/lib/fog/openstack.rb:152:in `authenticate'
C:/Ruby24/lib/ruby/gems/2.4.0/bundler/gems/fog-openstack-3d5f4ea27a41/lib/fog/openstack/core.rb:182:in `authenticate'
C:/Ruby24/lib/ruby/gems/2.4.0/bundler/gems/fog-openstack-3d5f4ea27a41/lib/fog/storage/openstack.rb:98:in `initialize'

我查看了here,试图找出验证时可能缺少什么,但我找不到。

这个 curl 工作 curl -i -H "Content-Type: application/json" -d @bm.json https://identity.open.softlayer.com/v3/auth/tokens

bm.json 在哪里:

{
   "auth": {
       "identity": {
           "methods": [
               "password"
           ],
         "password": {
               "user": {
                   "id": "1a5...",
                 "password": "O_C..."
             }
           }
       },
     "scope": {
           "project": {
               "id": "b71..."
         }
       }
   }
}

所以发送这个就足够了:

openstack_auth_url:    "https://identity.open.softlayer.com/v3/auth/tokens",
openstack_api_key:      "O_C...",
openstack_userid:     "1a5...",
openstack_project_id:  "b71...",

我错过了什么?

【问题讨论】:

    标签: ruby-on-rails authentication openstack fog object-storage


    【解决方案1】:

    由于您使用的是 v3,因此他们的文档建议设置:

    @connection_params = {
        openstack_auth_url:     "http://devstack.test:5000/v3/auth/tokens",
        openstack_username:     "admin",
        openstack_api_key:      "password",
        openstack_project_name: "admin",
        openstack_domain_id:    "default"
     }   
    

    我将使用用户名而不是用户 ID、项目名称而不是项目 ID 再次对其进行测试,并指定域 ID。身份验证信息应该在您的服务凭证中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-17
      相关资源
      最近更新 更多