Search Results :
×ASP.NET Core as SAML identity provider provides a ready-to-use solution for SAML 2.0 login using ASP.NET credentials. ASP.NET Core SAML IdP acts as a SAML 2.0 identity provider which can be configured to establish the trust between the ASP.NET Core application and various SAML 2.0 supported service providers such as WordPress,Tableau, Moodle and many more to securely authenticate the users using the ASP.NET Core application credentials.
Not able to find your IdP? Contact us at aspnetsupport@xecurify.com and we will help you setup ASP.NET Core SSO with your SP in no time.
Reach out to us at aspnetsupport@xecurify.com and we will help you setup Blazor SAML SSO with your identity provider (IdP) in no time.
using Microsoft.AspNetCore.Authentication.Cookies; using miniOrange.saml; var builder = WebApplication.CreateBuilder(args); builder.Services.AddRazorPages(); // Add authentication services builder.Services.AddControllersWithViews(); builder.Services.AddAuthentication(options => { options.DefaultAuthenticateScheme = "SSO_OR_Admin"; options.DefaultScheme = "SSO_OR_Admin"; options.DefaultChallengeScheme = "SSO_OR_Admin"; }) .AddCookie("moAdmin", options => { }) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => { // Configure cookie options as needed for SSO Users }) .AddPolicyScheme("SSO_OR_Admin", "SSO_OR_Admin", options => { // runs on each request options.ForwardDefaultSelector = context => { // filter by auth type, here if the moAdmin cookie is coming in any request the Admin Authentication will work foreach (var cookie in context.Request.Cookies) { if (cookie.Key.Contains(".AspNetCore.Cookies")) { return CookieAuthenticationDefaults.AuthenticationScheme; } } // otherwise always check for cookie auth return "moAdmin"; }; }); var app = builder.Build(); if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.MapRazorPages(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseStaticFiles(); app.UseminiOrangeSAMLSSOMiddleware(); app.Run();
https://<your-application-base-url>/?ssoaction=config
Note: After installation of the plugin, we need to setup the trust between your ASP.NET Core application and your service provider. SAML metadata is shared with identity provider so they can update their inbuilt configuration to support SAML Single Sign-On.
There are two ways detailed below with which you can configure your ASP.NET Core SAML identity provider metadata in the middleware.
To send the details from ASP.NET Core application to your service provider in the form of SAML tokens first, we will be required to set the authenticated user details in user claims.
var UserClaims = new List<claim>() { new Claim(ClaimTypes.NameIdentifier, "test.user@gmail.com") }; // Add your additional Claims UserClaims.Add(new Claim("email", "test.user@xecurify.com")); UserClaims.Add(new Claim("firstname", "test")); UserClaims.Add(new Claim("lastname", "user")); UserClaims.Add(new Claim("PhoneNumber", "9876543210")); // Set the User Identity with your User Claims and set your Authentication Scheme var identity = new ClaimsIdentity(UserClaims, CookieAuthenticationDefaults.AuthenticationScheme); var principal = new ClaimsPrincipal(identity); await httpContextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
<a href="https://<your-application-base-url>/?ssoaction=idpinitiatedsso"
<a
href=”https://<your-application-base-url>/?ssoaction=idpinitiatedsso”>Login</a>
Not able to find your service provider? Mail us on aspnetsupport@xecurify.com and we'll help you set up SSO with your SP and for quick guidance (via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.
Need Help? We are right here!
Thanks for your inquiry.
If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com