title: How to use Sustainsys.Saml2.AspNetCore2 in existing net core app?
body: <p>I'm trying to use Sustainsys.Saml2 and Sustainsys.Saml2.AspNetCore2 library provided by <a href="https://github.com/Sustainsys/Saml2" rel="nofollow noreferrer">this</a> saml2 library to implement both IDP initiated and SP initiated scenarios.</p>
  
  <p>After referring sample appliation things I did so far:<br>
  1. Refer latest Sustainsys.Saml2.AspNetCore2 and Sustainsys.Saml2 via nuget<br>
  2. Modified Startup.cs to add new options<br>
  3. Created MVC controller with ACS end point</p>
  
  <p>Things I'm trying to understand:<br>
  1. Do I need to Initiated Saml2Handler so that I can hit HandleRequestAsync() end point of library.<br>
  2. How to retrive principal/claims<br>
  3. For sp initiated case when end point identifies request is not authenticated how to redirect request to IDP?<br>
  <strong>ConfigureServices method in startup.cs</strong></p>
  
  <pre><code>        public void ConfigureServices(IServiceCollection services)
              {
                  services.AddAuthentication()
                      .AddSaml2(options =&gt; 
                      {
                          options.SPOptions.EntityId = new EntityId("https://localhost:3131/Saml2");
                          options.IdentityProviders.Add(
                              new IdentityProvider(
                                  new EntityId("http://localhost:52071/Metadata"), options.SPOptions)
                              {
                                  LoadMetadata = true
                              });
  
                          options.SPOptions.ServiceCertificates.Add(new X509Certificate2("Sustainsys.Saml2.Tests.pfx"));
                      });
              }
  
      **SSO Controller** 
  
  
              [Authorize(AuthenticationSchemes = "Saml2")] 
              public class SsoController : Controller
              {
                  public SingleSignOnController(ILogger logger)
                  {
                  }
  
                  [Route("saml2/ACS")]
                  [HttpPost]
                  public ActionResult ACS()
                  {
                      try
                      {   
                      // Is request authenticated here by library? 
                      // I tried hitting this end point from stud idp portal, but it is    
    throwing " MVC Exception Handler: The method or operation is not implemented.    at Sustainsys.Saml2.AspNetCore2.Saml2Handler.AuthenticateAsync()
         at Microsoft.AspNetCore.Authentication.AuthenticationService"         
                      }
                      catch (Exception e)
                      {
  
                      }
                  }
              }
  </code></pre>
  
  <p>Do I need to create/implement Custom <strong>Saml2Handler</strong> and inject it in SSo controller? I could not find exact end point in this <a href="https://github.com/Sustainsys/Saml2/tree/master/Samples/SampleAspNetCore2ApplicationNETFramework" rel="nofollow noreferrer">ASPNETSAMPLE</a> project for saml2/ACS?    </p>
  
  <p>What I'm missing ?</p>