Identity Server | ASP.NET Core SSO Framework
Identity Server

IdentityServer Free SSO Solution

Cross Platform SSO Framework Using OpenID Connect and OAuth 2

Single Sign On Framework to build access control solutions for modern web applications and APIs. Simplify authentication management by centralizing to one place.

IdentityServer is a open source framework that uses openid connect and oauth 2.0 to achieve single sign on, acts as a single authentication and authorization server for multiple applications.

IdentityServer supports both full .NET framework (4.5.x) and .NET Core (which is cross platform). IdentityServer 4 takes the benefits of .NET Core and can be deployed using docker on linux systems.

It follows Open ID Connect and OAuth 2.0 specifications and supports wide range of clients like mobile, web and SPAs. It’s database agnostic so you can use any back-end of your choice. It acts as a Authentication server which will allow users to sign in and provides a JWT bearer token that can be used to access protected resources from a SPA or mobile app. It can be used to provide authentication for multi-tenant apps, hosted on separate domains. It achieves app sso using OIDC (which is an authentication layer on top of OAuth2).

System Requirements

  • ASP.NET Core 3.0
  • IIS / Docker

Features

  • Authentication as Service:
  • Single Sign-on /Sign-out
  • Access Control for API
  • Supports Federated Identities (Google,Facebook etc).
  • UI Customization
  • Multiple Flows (Implicit, Authorization code etc).
  • API Authorization
  • Claim-based provider

Installation

Install directly from Nuget

You can install directly from nuget using following command:

Install-Package IdentityServer4 -Version 4.0.4

Install IdentityServer4 Templates

dotnet new -i IdentityServer4.Templates  

Add QuickUI files and ASP.NET Identity (optional)

dotnet new is4aspid --force  

Update ConfigureServices() method in startup.cs as below:

services.AddControllersWithViews();  

Also update Configure() method in startup.cs :

app.UseRouting();  
   
 app.UseIdentityServer();  
 app.UseAuthorization();   
 app.UseEndpoints(endpoints =>  
 {  
 endpoints.MapControllerRoute(  
 name: "default",  
 pattern: "{controller=Home}/{action=Index}/{id?}");  
 });  

Build and run the project

Browse “/.well-known/openid-configuration” to make sure discovery endpoints is up and running.

Running in Docker

  1. Create an empty ASP.NET Core Project (Check ‘Enable Docker Support”)

  2. Make sure the project file targets Linux OS Linux

  3. Modify the docker file as below:

    FROM microsoft/dotnet:2.2-runtime AS base  
    WORKDIR /app  
    EXPOSE 80  
    EXPOSE 443  
    
    FROM microsoft/dotnet:2.2-sdk AS build  
    WORKDIR /src  
    COPY \[“JrTech.Identity.Web/JrTech.Identity.Web.csproj“, “JrTech.Identity.Web/”\]  
    RUN dotnet restore “JrTech.Identity.Web/JrTech.Identity.Web.csproj“  
    COPY . .  
    WORKDIR “/src/JrTech.Identity.Web”  
    RUN dotnet build “JrTech.Identity.Web.csproj” -c Release -o /app  
    
    FROM build AS publish  
    RUN dotnet publish “JrTech.Identity.Web.csproj” -c Release -o /app  
    
    FROM base AS final  
    WORKDIR /app  
    COPY –from=publish /app .  
    ENTRYPOINT \[“dotnet”, “JrTech.Identity.Web.dll”\]  
    
  • Add IdentityServer 4  by running the following command:

    dotnet add package IdentityServer4

Explore

You may find the following links relevant: