SAML2Core 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SAML2Core --version 1.1.1
NuGet\Install-Package SAML2Core -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SAML2Core" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SAML2Core --version 1.1.1
#r "nuget: SAML2Core, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SAML2Core as a Cake Addin
#addin nuget:?package=SAML2Core&version=1.1.1

// Install SAML2Core as a Cake Tool
#tool nuget:?package=SAML2Core&version=1.1.1

Usage

  1. Modify ConfigureServices() in Startup.cs
services.AddAuthentication(sharedOptions =>
{
    sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddSamlCore(options =>
{
    // ApplicationURL (REQUIRED) - This is the url for the production application. 
    // This will be used to create two Assertion Consumer Endpoints in your metadata.xml. 
    // One will be for example https://my.la.gov/sign-in
    // Second one will be https://[localhost environment]/sign-in 
    options.ApplicationURL = "https://my.la.gov";

    // SignOutPath (REQUIRED) - The endpoint for the idp to perform its signout action
    options.SignOutPath = "/signedout";

    // EntityId (REQUIRED) - The Relying Party Identifier e.g. https://my.la.gov.local
    options.ServiceProvider.EntityId = Configuration["AppConfiguration:ServiceProvider:EntityId"];

    // There are two ways to provide FederationMetadata
    // Option 1 - A FederationMetadata.xml already exists for your application
    // options.MetadataAddress = @"FederationMetadata.xml";

    // Option 2 - Have the middleware generate the FederationMetadata.xml file for you
    options.MetadataAddress = Configuration["AppConfiguration:IdentityProvider:MetadataAddress"];

    // Have the middleware create the metadata file for you
    // The default is false. If you don't want a file generated by the middleware, comment the line below.
    options.CreateMetadataFile = true;

    // If you want to specify the filename and path for the generated metadata file do so below:
    //options.DefaultMetadataFileName = "MyMetadataFilename"; //the default is "Metadata".
    //options.DefaultMetadataFolderLocation = "MyPath"; //the default is "wwwroot" so it can be accessible via https://[host name]/MyMetadataFilename.xml.

    //************************************************************************************************************ 
    // The following section is if your application (SP) has a certificate and is signing the Authn Request with it.
    //************************************************************************************************************
    // Certificate (REQUIRED) if you want you application (SP) to sign the authentication request (AuthnRequest)
    // The certificate serial number value. 
    options.ServiceProvider.SigningCertificateX509TypeValue = Configuration["AppConfiguration:ServiceProvider:CertificateSerialNumber"]; //your certifcate serial number (default type which can be chnaged by ) that is in your certficate store

    // For signed AuthnRequest - if you want the search for the Sp certificate by somethign else other than SerialNumber. The default is serial number. 
    //options.ServiceProvider.CertificateIdentifierType = X509FindType.FindBySerialNumber; // the default is 'X509FindType.FindBySerialNumber'. Change value of 'options.ServiceProvider.SigningCertificateX509TypeValue' if this changes
    
    //************************************************************
            
    // Force Authentication (optional) - if you are requiring users to log into the Idp every time.
    options.ForceAuthn = true;

    // Service Provider Properties (optional) - These set the appropriate tags in the metadata.xml file
    options.ServiceProvider.ServiceName = "My Test Site";
    options.ServiceProvider.Language = "en-US";
    options.ServiceProvider.OrganizationDisplayName = "Louisiana State Government";
    options.ServiceProvider.OrganizationName = "Louisiana State Government";
    options.ServiceProvider.OrganizationURL = "https://my.test.site.gov";
    options.ServiceProvider.ContactPerson = new ContactType()
    {
        Company = "Louisiana State Government - OTS",
        GivenName = "Dina Heidar",
        EmailAddress = new[] { "dina.heidar@la.gov" },
        contactType = ContactTypeType.technical,
        TelephoneNumber = new[] { "+1 234 5678" }
    };

    // Events - Modify events below if you want to log errors, add custom claims, etc.

    //options.Events.OnRemoteFailure = context =>
    //{
    //    return Task.FromResult(0);
    //};              
    //options.Events.OnTicketReceived = context =>
    //{  //TODO: add custom claims here
    //    return Task.FromResult(0);
    //};               
})
.AddCookie();
  1. Modify Configure() in Startup.cs

Don't forget to add the following line in Configure()

app.UseAuthentication();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.3 34,742 1/28/2021
3.1.0 21,123 2/28/2020
3.0.0 681 1/27/2020
2.0.6 9,748 6/10/2019
2.0.4 575 6/8/2019
2.0.3 577 6/6/2019
2.0.2 580 6/6/2019
1.1.7 871 12/17/2018
1.1.6 705 12/14/2018
1.1.4 665 12/13/2018
1.1.3 672 11/21/2018
1.1.2 679 11/20/2018
1.1.1 683 11/20/2018
1.0.9 662 11/16/2018
1.0.8 703 11/16/2018