title: Requester/InvalidNameIDPolicy Error with SimpleSAMLPHP SP and ADFS IDP
body: <p>After looking all over the Internet, particularly </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/19816803/adfs-2-0-invalidnameidpolicy">ADFS 2.0 InvalidNameIDPolcy</a></li>
  <li><a href="https://groups.google.com/forum/#!topic/simplesamlphp/I8IiDpeKSvY" rel="noreferrer">Using SimpleSAMLphp to Authenticate against ADFS 2.0 IdP</a></li>
  <li><a href="https://groups.google.com/forum/#!topic/simplesamlphp/0PtXLkapkA4" rel="noreferrer">Requester/InvalidNameIDPolicy</a></li>
  </ul>
  
  <p>I tried all the suggested modifications to authsource.php and metadata php. Nothing worked.</p>
  
  <p>Here is my authsource.php</p>
  
  <pre><code>'default-sp' =&gt; array(
      'saml:SP',
      'privatekey' =&gt; 'saml.pem',
      'certificate' =&gt; 'saml.crt',
      'idp' =&gt; 'http://domain.com/adfs/services/trust',
  </code></pre>
  
  <p>I used the <code>XML to simpleSAMLphp metadata converter</code> to generate the <code>saml20-idp-remote.php</code></p>
  
  <p>So when I access the page, SimpleSAMLPHP correctly redirects me to the IDP login page. I decoded the SAML Request:</p>
  
  <pre><code>&lt;samlp:AuthnRequest 
      xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
      xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" 
      ID="_4e03333c7aa76314d965e05f8fcdd3e1f4c5be96c8" 
      Version="2.0" 
      IssueInstant="2014-12-11T19:41:50Z" 
      Destination="https://domain.com/adfs/ls/" 
      AssertionConsumerServiceURL="https://sub.domain.com/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp" 
      ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"&gt;
  
      &lt;saml:Issuer&gt;
          https://su.bdomain.com/simplesaml/module.php/saml/sp/metadata.php/default-sp
      &lt;/saml:Issuer&gt;
      &lt;samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" AllowCreate="true"/&gt;
  
  &lt;/samlp:AuthnRequest&gt;
  </code></pre>
  
  <p>After logging in with a valid test account, I'm redirected back to my site with the error.</p>
  
  <pre><code>SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
  Backtrace:
  0 /var/www/html/igt_s3k/web/simplesamlphp/www/module.php:179 (N/A)
  Caused by: sspmod_saml_Error: Requester/InvalidNameIDPolicy
  Backtrace:
  3 /var/www/html/igt_s3k/web/simplesamlphp/modules/saml/lib/Message.php:385 (sspmod_saml_Message::getResponseError)
  2 /var/www/html/igt_s3k/web/simplesamlphp/modules/saml/lib/Message.php:495 (sspmod_saml_Message::processResponse)
  1 /var/www/html/igt_s3k/web/simplesamlphp/modules/saml/www/sp/saml2-acs.php:96 (require)
  0 /var/www/html/igt_s3k/web/simplesamlphp/www/module.php:134 (N/A)
  </code></pre>
  
  <p>I tried setting different NameIDPolicy but none of them worked.</p>
  
  <pre><code>    //'NameIDFormat' =&gt; 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
      //'NameIDPolicy' =&gt; 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
      //'NameIDPolicy' =&gt; 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
      //'NameIDPolicy' =&gt; 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
  </code></pre>
  
  <p>Thanks!</p>