Impersonating another user in SoftLayer

前端 未结 1 1816
粉色の甜心
粉色の甜心 2021-01-26 08:51

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 allowi

相关标签:
1条回答
  • 2021-01-26 09:09

    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

    0 讨论(0)
提交回复
热议问题