在SoftLayer中模拟其他用户 [英] Impersonating another user in SoftLayer

查看:57
本文介绍了在SoftLayer中模拟其他用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在SoftLayer中有一个代理帐户,通过该帐户已创建了多个客户帐户.我试图对客户帐户进行一些操作,但是自从我的SoftLayer Python客户端使用代理帐户的用户名/密码以来,该API不允许进行任何操作.

We have an agent account in SoftLayer through which multiple Customer accounts have been created. Im trying to do some operations on the Customer account but the API isnt allowing any operations to be done since my SoftLayer Python Client uses the username/password of the agent account.

我浏览了许多帖子,并冒充客户帐户的"SoftLayer_User_Customer"作为一种可能的解决方案,但是关于如何使用它没有太多细节.我能够使用 getImpersanationToken 来获得令牌,但是我不确定如何使用这个.

I browsed through a lot of posts and impersonating as the "SoftLayer_User_Customer" of the customer account was given as a possible solution but there isnt much detail as to how to use it. I was able to get a Token using the getImpersanationToken call, but Im unsure how to use this.

是否有任何示例说明如何从主品牌帐户以客户用户身份登录(使用模拟或其他方式)?

Are there any examples of how to login(Either using impersonation or another way) as a Customer User from a Master Brand Account?

我使用的是Softlayer Python API,但也使用SOAP调用进行了尝试.

Im using the Softlayer Python API but have tried this using the SOAP calls as well.

推荐答案

您需要的方法是这样的:

the method that you need is this one:

http://sldn.softlayer.com/reference/services/SoftLayer_Brand/getToken

使用python客户端,您将获得以下内容:

using the python client you will have something like this:

    token = client['SoftLayer_Brand'].getToken(userID, id=brandID)

其中userID是您要获取令牌的用户的ID,而brandId是您帐户的品牌ID

where userID is the id of the user you want to get the token and the brandId is the brand id of your account

您需要使用这样的SOAP请求:

The you need to use a SOAP request like this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.service.softlayer.com/soap/v3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Header>
    <ns1:clientLegacySession>
      <userId>$USERID</userId>
      <authToken>$TOKEN</authToken>
    </ns1:clientLegacySession>
    <ns1:SoftLayer_User_CustomerInitParameters>
      <id>$USERID</id>
    </ns1:SoftLayer_User_CustomerInitParameters>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:addApiAuthenticationKey/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

上面的代码正在调用方法 http://sldn.softlayer.com/对于您在上一个请求中获得令牌的用户,则为reference/services/SoftLayer_User_Customer/addApiAuthenticationKey .

The soap above is calling the method http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/addApiAuthenticationKey for the user that you got the token in the previous request.

别忘了替换SOAP中的$ USERID和$ TOKEN值

Not forget replace the values $USERID and $TOKEN in the SOAP

致谢

这篇关于在SoftLayer中模拟其他用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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