openstacksdknet上的CloudIdentity(找不到用户) [英] CloudIdentity on openstacksdknet (Could not find user)

查看:361
本文介绍了openstacksdknet上的CloudIdentity(找不到用户)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用已经排定支持OpenStack.NET v1.5.2中的身份v3(我们目前在v1.5.0.1)。但这不会发生几个月。


I am working on a Cloud Backup client by using OpenStack SDK .NET and I'm trying to identify with user credentials, sent to me from the server administrator. For the test everything seems to work perfect on the python openstack client. I use Advanced Rest Client Chrome Extension to get the token:

http://xx.xx.xx.xx:5000/v3/auth/tokens
POST METHOD

Header:
Content-Type: application/json

Body:

{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "id": "e5f4ec652c5e4d97b8fe6266113ac9f3",
                    "password": "PasswordFromAdministrator"
                }
            }
        },
        "scope": {
            "project": {
                "id": "9b594b7c51484702b6b4d1a91c6aa2ed"
            }
        }
    }
}

The response is with status Created (201):

Date: Tue, 20 Oct 2015 10:28:26 GMT 
Server: Apache/2.4.7 (Ubuntu) 
X-Subject-Token: d3b8133fea7846abbe2f023f410e3294
Vary: X-Auth-Token 
x-openstack-request-id: req-a517ee76-9353-4c7c-b646-47f566c84838
Content-Length: 1756 
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json 

With the X-Subject-Token I log into a openstack server with python client with the command:

openstack --os-url http://xx.xx.xx.xx:5000/v3 --os-identity-api-version 3 --os-token=d3b8133fea7846abbe2f023f410e3294

And the authorization is OK. Projects, Users, Containers, everything is listed perfect. The problem comes, when I try to use OpenStack APIs for .NET. I use OpenStack SDK .NET and CloudIdentity Class in all forms (CloudIdentity, CloudIdentityWithProject) and the response allays is "Could not find user XXXX (Disable debug mode to suppress these details.)":

    static void Main(string[] args)
    {
        var username = "myuser";
        var password = "PasswordFromAdministrator";
        var project_name = "backup";
        var project_id = "9b594b7c51484702b6b4d1a91c6aa2ed";
        var auth_url = "http://xx.xx.xx.xx:5000/v3";
        var region = "RegionOne";

        var identity = new CloudIdentityWithProject()
        {
            Username = username,
            Password = password,
            ProjectId = new ProjectId(project_id),
            ProjectName = project_name
        };

        //var identity = new CloudIdentity()
        //{
            //Username = username,
            //Password = password,
        //};

        var identityProvider = new OpenStackIdentityProvider(new Uri(auth_url));

        var conn = new CloudFilesProvider(identity, identityProvider);

        // step-2
        var containers = conn.ListContainers();
        foreach (var container in containers)
        {
            Console.WriteLine(string.Format("Container Name: {1}", container.Name));
        }
    }

The user exists in the server and have administrative role for the project. So the questions are: 1. Is this the right way to identity in openstack server? 2. If not, is there better API for backup files in openstack?

解决方案

Unfortunately, at this time, OpenStack.NET only supports OpenStack Identity v2.0, not v3. Perhaps you can ask your administrator if there is a v2 identity endpoint available for you to use?

The roadmap has scheduled support for identity v3 in OpenStack.NET v1.5.2 (we are currently on v1.5.0.1). But that won't happen for a few months.

这篇关于openstacksdknet上的CloudIdentity(找不到用户)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆