<div class="content"><p>The AttachCurrentSecurityContext2 method is received by the
server in an RPC_REQUEST packet. In response, the <a href="3b7be3f7-651c-4f9c-930b-a9a7c4355ad8#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a> caches the relevant
information required to sign a <a href="3b7be3f7-651c-4f9c-930b-a9a7c4355ad8#gt_85c78cf0-1fb6-4e5d-85f5-a2e9f58a6b9e" data-linktype="relative-path">message</a> on behalf of the
client, including Message.SenderIdentifier and Message.SenderCertificate. This
method is provided purely as an optimization to allow the client to reduce
lookups of the security information about the calling client each time the
message is sent. The represented Message.SenderIdentifier and Message.SenderCertificate
property values MUST NOT be updated as a result of calling this method.</p><dl>
<dd>
<div><pre> HRESULT AttachCurrentSecurityContext2();
</pre></div>
</dd></dl><p>This method has no parameters.</p><p><b>Return Values: </b>The method MUST return S_OK
(0x00000000) on success or an implementation-specific error <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
on failure.</p><p>When processing this call, the server MUST follow these
guidelines:</p><ul><li><p><span><span> 
</span></span>Set the <i>SenderIdentifierCache</i> instance variable to the SID
of the caller.<a id="Appendix_A_Target_155"></a><a aria-label="Product behavior note 155" href="71c359c3-e9ec-4fe6-a101-aab1eabecdcf#Appendix_A_155" data-linktype="relative-path">&lt;155&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the represented Message.SenderCertificate equals NULL:</p>
<ul><li><p><span><span>  </span></span>Set
the <i>SenderCertificateCache</i> instance variable to the <b>Certificate</b>
ADM attribute of the <b>InternalCertificate</b> (<a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a>
section <a href="../ms-mqdmpr/b9c56cb5-9c06-4c07-ad1a-6850ed9c7d6e" data-linktype="relative-path">3.1.1.19</a>)
ADM element instance from the <b>InternalCertificateCollection</b> ADM attribute
of the local <b>QueueManager</b> ADM element instance whose <b>InternalCertificate.User</b>
ADM attribute matches the user identified by the <i>SenderIdentifierCache</i>
instance variable.</p>
</li></ul></li><li><p><span><span> 
</span></span>Else:</p>
<ul><li><p><span><span>  </span></span>The
server MAY impose additional requirements on the represented Message.SenderCertificate
for authentication purposes.<a id="Appendix_A_Target_156"></a><a aria-label="Product behavior note 156" href="71c359c3-e9ec-4fe6-a101-aab1eabecdcf#Appendix_A_156" data-linktype="relative-path">&lt;156&gt;</a></p>
</li><li><p><span><span>  </span></span>Set
the <i>SenderCertificateCache</i> instance variable to the value of the
represented Message.SenderCertificate.</p>
</li></ul></li></ul></div>