SAML Single Sign-On (SSO) For ASP.NET Web Applications Using Keycloak As IdP

ASP.NET SAML SP Single Sign-On (SSO) module gives the ability to enable SAML Single Sign-On for your ASP.NET applications. Using Single Sign-On you can use only one password to access your ASP.NET application and services. Our module is compatible with all the SAML compliant Identity providers. Here we will go through a step-by-step guide to configure Single Sign-On (SSO) between ASP.NET and Keycloak as IdP.

Download And Extract Package

  • Download miniOrange ASP.NET SAML 2.0 Module.
  • For Setting up the module, extract the asp-net-saml-sso-module-xxx.zip, you will find a DLL file miniorange-saml-sso.dll, a configuration file saml.config and a integration.md file which contain the steps for adding the module into your application.

Step 1: Add module in your application

  • Add miniorange-saml-sso.dll in the bin folder (where your other DLL files exist) for your application.
  • Register miniorangesamlsso module in your application according to the provided steps in the integration.md file.
  • Add the provided configuration file saml.config in the root directory for your application.
  • After integration open browser and browse the module dashboard with URL below:
    • https://<your-application-base-url>?ssoaction=config
  • If it pops up the registration page or login page, you have successfully added the miniOrange saml sso module for your application.

  • ASP.NET Keycloak SAML SSO  - login page
  • Register or Login for configuring the module.

Step 2: Configure Keycloak as Identity Provider

Follow the steps below to configure Keycloak as IdP

  • In the miniOrange ASP.NET SAML SSO Module, navigate to Service Provider Settings section. Here, you can find the SP metadata such as SP Entity ID and ACS (AssertionConsumerService) URL which are required to configure the Identity Provider.
  • ASP.NET Keycloak SAML SSO  - upload metadata
  • In your Keycloak admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create button to create a new client/application.
  • Creating an APP - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Enter Client ID as the SP-EntityID / Issuer from the Service Provider Metadata and select SAML as the Client Protocol.
  • Add Client - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Now click on Save.
  • Configure the following in Keycloak:
  • Client ID The SP-EntityID / Issuer from the plugin's Service Provider Metadata tab
    Name Provide a name for this client
    Description Provide a description
    Name ID Format Email
    Root URL Leave empty or Base URL of Service Provider
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Keycloak Login - Settings - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Under Fine Grain SAML Endpoint Configuration, configure the following in Keycloak:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
    Login SAML Endpoint Configuration - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Click on Save.

 Add Mappers

  • Go to Mappers tab and click on Add Builtin button.
  • Keycloak Login - Mappers Tab - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Check the boxes of X500 givenName, X500 surname and X500 email attributes.
  • Keycloak Login - Add built-in protocol mapper - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Click on Add Selected button. You will see the mappings as shown in the photo below.
  • Keycloak Login - Add Selected - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login

miniorange img Download setup file

  • Go to Realm Settings, click on SAML 2.0 Identity Provider Metadata mentioned as endpoints in the General Tab.
  • JBoss Keycloak SSO-7 - Keycloak SAML Single Sign-On(SSO) for WordPress - Keycloak SSO Login
  • Note the URL and keep it handy. Here you can find the information which will be used to configure the plugin.

Step 3: Configure ASP.NET SAML Module as Service Provider

  • After configuring your Identity Provider, it will provide you with IDP Entity ID, IDP Single Sign On URL and x.509 Certificate. Configure these values under IDP Entity ID, Single Sign-On Url and SAML X509 Certificate fields respectively. (Refer to the Metadata provided by Identity Provider)
  • Click Save to Save your IDP details.
  • ASP.NET Keycloak SAML SSO  - idp settings

Step 4: Test Configuration

  • Click on the Test Configuration button to test the configuration.
  • ASP.NET Keycloak SAML SSO -  test configuration settings

Step 5: Attribute Mapping

  • After testing the configuration, Map your application attributes with the Identity Provider (IdP) attributes.
  • Note: All the mapped attributes will be stored in the session so that you can access them in your application.
  • ASP.NET Keycloak SAML SSO -  attribute mapping

Step 6: Integration Code

  • You can also find the Integration code in the Integration Code tab in the module. Just copy-paste that code snippet wherever you want to access the user attributes.
  • Note: All the mapped attributes will be stored in the session so that you can access them in your application.
  • ASP.NET Keycloak SAML SSO  - integration code

Step 7: Login Settings

  • Use the following URL as a link in your application from where you want to perform SSO:
  • https://<your-application-base-url>/?ssoaction=login
  • For example you can use it as:
  • <a href="https://<your-application-base-url>/?ssoaction=login">Login</a>

Step 8: Logout Settings

  • Use the following URL as a link in your application from where you want to perform SLO:
  • https://<your-application-base-url>/?ssoaction=logout
  • For example you can use it as:
  • <a href="https://<your-application-base-url>/?ssoaction=logout">Logout</a>

    You can configure the ASP.NET SAML 2.0 Single Sign-On (SSO) module 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.

Application LINK
SAML SSO into DotNetNuke (DNN) site Click here
SAML SSO into SiteFinity site Click here
SAML SSO into Umbraco site Click here
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