Working with SAML 2.0 in C# .NET 4.5

.NET 4.5 has WIF (Windows Identity Foundation) built into it. This now supports SAML 2.0. To make use of SAML 2.0, just use .NET 4.5. The class name is Saml2XXXX (where XXXX is the token, assertion, serializer etc) Here is a link to SAML 2.0 Assertion: http://msdn.microsoft.com/en-us/library/microsoft.identitymodel.tokens.saml2.saml2assertion.aspx This will create a SAML 2.0 Assertion object. … Read more

ASP.Net Core SAML authentication

This is probably basically an updated version of Anders Abel’s answer, but: I used https://github.com/Sustainsys/Saml2. They have a nuget package with 36k downloads called “Sustainsys.Saml2.AspNetCore2”. They have a helpful example .net core app using it that also uses .net core identity here: https://github.com/Sustainsys/Saml2/tree/master/Samples/SampleAspNetCore2ApplicationNETFramework (take a look at their startup.cs and also their external login razor … Read more

SAML Assertion in a XML using C#

try following : using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.Xml; using System.Text; using System.Threading.Tasks; using System.Xml; namespace Certificate { class Program { const string FILENAME = @”c:\temp\test.xml”; static void Main(string[] args) { XmlDocument doc = new XmlDocument(); CreateSoap(doc); XmlElement assertion = (XmlElement)(doc.GetElementsByTagName(“saml2:Assertion”)[0]); XmlElement security = (XmlElement)(doc.GetElementsByTagName(“wsse:Security”)[0]); //added 10-20-17 … Read more