title: IdP initiated SSO with SimplesamlPHP
body: <p>I am having trouble implementing an IdP initiated login with SimplesamlPHP.
  Understanding what I have to do from the documentation is not the easiest thing.</p>
  
  <p>I am redirecting the user to the IdP server and after logging in, the server sends the SP an XML file which includes the email user's address, ID and other data.
  This looks like a successful login but at this point I don't know what to do with that XML. Should i parse it myself or use simplesaml for that?
  How do i validate the signature?</p>
  
  <p>Here is the XML I am receiving:</p>
  
  <pre><code>&lt;samlp:Response Destination="http://example.com/auth/acs" ID="HK1goP6OuzQs2Xrd-CN9gAkRt0Z" IssueInstant="2016-05-25T13:52:32.075Z" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"&gt;
  &lt;saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;Stage-az:sp:MediEventsregapp&lt;/saml:Issuer&gt;
  &lt;ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
      &lt;ds:SignedInfo&gt;
          &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/&gt;
          &lt;ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/&gt;
          &lt;ds:Reference URI="#HK1goP6OuzQs2Xrd-CN9gAkRt0Z"&gt;
              &lt;ds:Transforms&gt;
                  &lt;ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/&gt;
                  &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/&gt;
              &lt;/ds:Transforms&gt;
              &lt;ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/&gt;
              &lt;ds:DigestValue&gt;anIASGQuZD+Z7oBVc/VJ9TuTDCcddHOkUHJuo4KGE4o=&lt;/ds:DigestValue&gt;
          &lt;/ds:Reference&gt;
      &lt;/ds:SignedInfo&gt;
      &lt;ds:SignatureValue&gt;Pw5N1U+IxXAkCARDLFHkSyinhCqy5jJ8ljkJRfVSCzWl9z/gZb87aSGs+1XH+yJJs9wOKlSisnaNBHDOPocoweqXMCePskQp0d46GX8FKLKrFPwNeyta/MnC+y2ujT/mRbd8znTkXt9ZKS2WNZbQuAgRP+4mIh+C4R0J7xjzBgPhJR+IpaAeSlFuI3oS2ggh5+fe68BQtreEAcwc4ehbt93SQA5ryXgVAWRX4COeuETj/4t5dVhk1f34JdUSO0n13U6xRheAyGJJ7njRMntNQCAGkcB6F7GEK0bEnLFTfImYhJOascURyjWUnCqyZbWt5SBKUNdWL1P90W2b17eqmg==&lt;/ds:SignatureValue&gt;
  &lt;/ds:Signature&gt;
  &lt;samlp:Status&gt;
      &lt;samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/&gt;
  &lt;/samlp:Status&gt;
  &lt;saml:Assertion ID="VFBGJiVRjw.GE4s8KVI2G0oyIOv" IssueInstant="2016-05-25T13:52:32.106Z" Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;
      &lt;saml:Issuer&gt;Stage-az:sp:MediEventsregapp&lt;/saml:Issuer&gt;
      &lt;saml:Subject&gt;
          &lt;saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"&gt;john.smith@example.com&lt;/saml:NameID&gt;
          &lt;saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"&gt;
              &lt;saml:SubjectConfirmationData NotOnOrAfter="2016-05-25T13:57:32.106Z" Recipient="http://example.com/auth/acs"/&gt;
          &lt;/saml:SubjectConfirmation&gt;
      &lt;/saml:Subject&gt;
      &lt;saml:Conditions NotBefore="2016-05-25T13:47:32.106Z" NotOnOrAfter="2016-05-25T13:57:32.106Z"&gt;
          &lt;saml:AudienceRestriction&gt;
              &lt;saml:Audience&gt;Stage-az:sp:MediEventsregapp&lt;/saml:Audience&gt;
          &lt;/saml:AudienceRestriction&gt;
      &lt;/saml:Conditions&gt;
      &lt;saml:AuthnStatement AuthnInstant="2016-05-25T13:52:32.106Z" SessionIndex="VFBGJiVRjw.GE4s8KVI2G0oyIOv"&gt;
          &lt;saml:AuthnContext&gt;
              &lt;saml:AuthnContextClassRef&gt;urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified&lt;/saml:AuthnContextClassRef&gt;
          &lt;/saml:AuthnContext&gt;
      &lt;/saml:AuthnStatement&gt;
      &lt;saml:AttributeStatement&gt;
          &lt;saml:Attribute Name="PRID" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"&gt;
              &lt;saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"&gt;kyjh364&lt;/saml:AttributeValue&gt;
          &lt;/saml:Attribute&gt;
      &lt;/saml:AttributeStatement&gt;
  &lt;/saml:Assertion&gt;
  </code></pre>
  
  <p></p>