4.6 Setting Up User Credentials for an Application

This example describes the requests that are made to set the credentials for user "CONTOSO\john" in the target application with target application name "MyTargetApplication".

The protocol client calls SetUserCredentials method on a protocol server named "server.contoso.com".

Protocol request:

 <Message>
    <HttpRequest xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
       <Method>POST</Method>
       <QueryString></QueryString>
       <WebHeaders>
          <Content-Length>105337</Content-Length>
          <Content-Type>application/soap+xml; charset=utf-8</Content-Type>
          <Expect>100-continue</Expect>
          <Host>server.contoso.com:32843</Host>
       </WebHeaders>
    </HttpRequest>
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
       <s:Header>
          <a:Action s:mustUnderstand="1" u:Id="_4" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.microsoft.com/sharepoint/2009/06/securestoreservice/ISecureStoreServiceApplication/SetUserCredentials</a:Action>
          <a:MessageID u:Id="_5" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:0ab86b6b-1e32-4fa7-8fef-6a63cc2df4fb</a:MessageID>
          <a:ReplyTo u:Id="_6" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">
             <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
          </a:ReplyTo>
          <a:To s:mustUnderstand="1" u:Id="_7" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">http://server.contoso.com:32843/ad004cd209134aecaf4d241a7f56e3ce/SecureStoreService.svc</a:To>
          <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
             <!-- This section is same as the preceding Example 1. -->
          </o:Security>
       </s:Header>
       <s:Body u:Id="_2" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
          <SetUserCredentials xmlns="http://schemas.microsoft.com/sharepoint/2009/06/securestoreservice/">
             <rawPartitionId>0c37852b-34d0-418e-91c6-2ac25af4be5b</rawPartitionId>
             <applicationId> MyTargetApplication</applicationId>
             <claim xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Office.SecureStoreService.Server" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:claimIssuer>localhost</a:claimIssuer>
                <a:claimType>http://schemas.microsoft.com/sharepoint/2009/08/claims/userlogonname</a:claimType>
                <a:claimValue>CONTOSO\john</a:claimValue>
             </claim>
             <credentials xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Office.SecureStoreService.Server" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:SerializableSecureStoreCredential>
                   <a:credential>U29tZVVzZXI=</a:credential>
                   <a:credentialType>UserName</a:credentialType>
                </a:SerializableSecureStoreCredential>
                <a:SerializableSecureStoreCredential>
                   <a:credential>VG9wU2VjcmV0</a:credential>
                   <a:credentialType>Password</a:credentialType>
                </a:SerializableSecureStoreCredential>
             </credentials>
          </SetUserCredentials>
       </s:Body>
    </s:Envelope>
 </Message>
  

The protocol server then responds with the following:

 <Message>
    <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
       <s:Header>
          <a:Action s:mustUnderstand="1">http://schemas.microsoft.com/sharepoint/2009/06/securestoreservice/ISecureStoreServiceApplication/SetUserCredentialsResponse</a:Action>
       </s:Header>
       <s:Body>
          <SetUserCredentialsResponse xmlns="http://schemas.microsoft.com/sharepoint/2009/06/securestoreservice/"></SetUserCredentialsResponse>
       </s:Body>
    </s:Envelope>
 </Message>