title: Use ITfoxtec.Identity.Saml2 to login user
body: <p>I am trying to implement SAML2.0 authentication using IdentityServer4 and ITfoxtec.Identity.Saml2 library.</p>
  <p>The first step is to login via the LDAP connection and this part worked well and i get user claims.</p>
  <p>Next step is to integrate login using AD FS</p>
  <p>I followed principally this tutorial</p>
  <p><a href="https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp" rel="nofollow noreferrer">https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp</a></p>
  <p>The Saml configuration code is below</p>
  <pre><code>services.Configure&lt;Saml2Configuration&gt;(saml2Configuration =&gt;
  {
      saml2Configuration.AllowedAudienceUris.Add(saml2Configuration.Issuer);
  
      var entityDescriptor = new EntityDescriptor();
      entityDescriptor.ReadIdPSsoDescriptorFromUrl(new Uri(Configuration[&quot;Saml2:IdPMetadata&quot;]));
      if (entityDescriptor.IdPSsoDescriptor != null)
      {
          saml2Configuration.SingleSignOnDestination = entityDescriptor.IdPSsoDescriptor.SingleSignOnServices.First().Location;
          saml2Configuration.SignatureValidationCertificates.AddRange(entityDescriptor.IdPSsoDescriptor.SigningCertificates);
      }
      else
      {
          throw new Exception(&quot;IdPSsoDescriptor not loaded from metadata.&quot;);
      }
  });
  
  services.AddSaml2();
  </code></pre>
  <p>After server redirection and before displaying the Idp login page i have an error &quot;certificate are not properly configured at application end&quot;</p>
  <p>This is the first time that I deal with SAML protocol. Any help is appreciated.</p>
  <p><strong>Edit :</strong> The error is on the AD FS Side</p>