Search Results :

×

Blazor SAML Single Sign-On (SSO) Setup Guide


Blazor SAML Single Sign-On (SSO) module gives the ability to enable SAML Single Sign-On for your Blazor applications. Using Single Sign-On you can use only one password to access your Blazor application and services. Our module is compatible with all the SAML compliant identity providers.

Steps to Configure the Blazor SAML 2.0 Middleware

Step 1: Pre-requisites: Download and Installation

  • Install the Blazor SAML SSO Middleware in your application package using the nuget package
PM> NuGet\Install-Package miniOrange.SAML.SSO.Middleware
    
using miniorange.saml public class Startup {   public void ConfigureServices(IServiceCollection services)   {      services.AddSession();      services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();      services.AddControllersWithViews();   }   public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)   {     app.UseHttpsRedirection();     app.UseStaticFiles();     app.UseRouting();     app.UseAuthorization();     app.MapRazorPages();     app.UseCookiePolicy();     app.UseAuthentication();     app.UseminiOrangeSAMLSSOMiddleware();     app.Run();   } }
    
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(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(); 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();
  • After integration, open your browser and browse the middleware dashboard with the URL below:
    https://<blazor-application-base-url>/?ssoaction=config
  • If the registration page or login page pops up, you have successfully added the miniOrange Blazor SAML SSO middleware to your application.
  • Blazor SAML Single Sign-On (SSO) - saml dll register
  • Register or log in with your account by clicking the Register button to configure the middleware.

Step 2: Configure your identity provider

  • You need to send your SP metadata to your identity provider. For SP metadata, use the SP metadata URL or download the SP metadata as a .xml file and upload it at your IdP end. You can find both these options under the Service Provider Settings tab.
  • Blazor SAML SSO - Copy SP Metadata
  • Alternatively, you can manually add the SP Entity ID and ACS URL from Service Provider Settings tab in the plugin to your IdP configurations.
  • Blazor SAML SSO - Copy SP Metadata manually

Step 3: Configure Blazor as Service Provider (SSO Middleware)

Note: After installation of the plugin, we need to setup the trust between your Blazor application and your identity provider. SAML metadata is shared with identity provider so they can update their inbuilt configuration to support Single Sign-On.

3.1: Share SAML Metadata with identity provider

  • Click on Add New IDP to configure Blazor Single Sign-On (SSO) using your identity provider.
  • Blazor SAML SSO - Click on Add new IDP
  • Under Service Provider Settings tab, you can either copy-paste the metadata URL on your IDP side or download the SP metadata as an XML file. Additionally, you have the choice to manually copy and paste Base URL, SP Entity ID, and ACS URL.
  • Share SAML metadata with your identity provider.
  • Blazor SAML SSO - SP Settings Metadata

3.2: Import identity provider SAML metadata

  • Select your identity provider from the list shown.
  • Blazor SAML SSO - Select identity provider

There are two ways detailed below with which you can configure your SAML identity provider metadata in the middleware.

A] Upload metadata using the Upload IDP Metadata button:
  • If your identity provider has provided you with the metadata URL or metadata file (.xml format only), then you can simply configure the identity provider metadata in the middleware using the Upload IDP Metadata option.
  • You may refer to the screenshot below:
  • Blazor SAML SSO - Upload Metadata
  • You can choose any one of the options according to the metadata format you have available.
B] Configure the identity provider metadata manually:
  • After configuring your Identity Provider, it will provide you with IDP Entity ID, IDP Single Sign On URL and SAML X509 Certificate fields respectively.
  • Click Save to save your IDP details.
  • Blazor SAML SSO - SAML dll config

Step 4: Testing SAML SSO

  • Before testing, please ensure the following:
    • The Blazor (SP) SAML metadata has been exported to the identity provider (IDP).
    • The Identity Provider (IDP) SAML metadata is imported in the Blazor (SP) SSO dashboard.
  • To test whether the SAML configuration you’ve done is correct, hover on Select Actions and click on Test Configuration.
  • Blazor SAML SSO - Click on Test Configuration
  • Note: In the trial version of the plugin, you can only configure and test one identity provider (IDP).
  • The screenshot below shows a successful result. Click on Done to further continue with the SSO Integration.
  • Blazor SAML SSO - SAML dll Test configuration
  • If you are experiencing any error on the middleware end you’ll be shown with the window similar to below.
  • Blazor SAML SSO - Enable debug logs
  • To troubleshoot the error you can follow the below steps:
    • Under Troubleshooting tab, enable the toggle to receive the plugin logs.
    • Blazor SAML SSO - Enable debug logs
    • Once enabled, you will be able to retrieve plugin logs by navigating to Identity Provider Settings tab and clicking on Test Configuration.
    • Download the log file from the Troubleshoot tab to see what went wrong.
    • You can share the log file with us at aspnetsupport@xecurify.com and our team will reach out to you to resolve your issue.

Step 5: Integration Code

  • This steps allow you to retrieve the SSO user information in your application in the form of user claims.
  • You can also look the setup tour to understand how the SSO integration would work in your Blazor application.
  • Just copy-paste that code snippet wherever you want to access the user attributes.
  • Blazor SAML SSO - Blazor Integration Codes Based on language
  • Note:This trial middleware only supports user information in claims, retrieving user information in session and headers is available in the premium plugin
  • You can also copy the integration code from below:
  •         
      string name="";   string claimtype="";   string claimvalue="";    if(User.Identity.IsAuthenticated)    {      foreach( var claim in User.Claims)      {        claimtype = claim.Type;        claimvalue = claim.Value;      }      retrive custom attributes(for eg. Retrieve Mapped 'mobileNumber' attribute of your IDP)      var identity = (ClaimsIdentity)User.Identity;      IEnumerable claims = identity.Claims;      string mobileNumber = identity.FindFirst("mobileNumber")?.Value;    }
  • Note: All the mapped attributes will be stored in the claims to be accessed in your application.
  • If you want some assistance regarding the integration code, get in touch with us at aspnetsupport@xecurify.com

Step 6: Add the following link into your application for Single Sign-On (SSO)

  • Hover on Select Actions and click on Copy SSO Link.
  • Blazor SAML SSO - Blazor Integration Codes Based on language
  • Use the copied link in the application from where you want to perform SSO:
    https://base-url/?ssoaction=login&appid=[Your-Application-ID]
  • For example, you can use it as:
    <a href=”https://base-url/?ssoaction=login”>Log in</a>

You can even configure the Blazor SAML Single Sign-On (SSO) with any identity provider such as ADFS, Azure AD, Bitium, Centrify, G Suite, JBoss Keycloak, Okta, OneLogin, SalesForce, AWS Cognito, OpenAM, Oracle, PingFederate, PingOne, RSA SecureID, Shibboleth-2, Shibboleth-3, SimpleSAML, WSO2 or even with your own custom identity provider.

Secure your Blazor application by performing Single Sign-On (SSO) into them. We also have modules for integrating legacy applications like Active Directory, SiteMinder, Radius, Unix, and others. Using SAML, OAuth, OpenID, ADFS, and WSFED protocols, we can help you add login/authentication to your ASP.NET application.

Additional Resources:

Need Help?

Not able to find your identity provider? Mail us on aspnetsupport@xecurify.com and we'll help you set up SSO with your IDP 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.

Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

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