Impersonating another user in SoftLayer

北城以北 提交于 2019-12-02 12:33:46

the method that you need is this one:

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

using the python client you will have something like this:

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

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

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>

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.

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

Regards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!