Skip to content

Sample solution for a basic Identity Server & Client using Aspire orchestration

Notifications You must be signed in to change notification settings

StuFrankish/AspireForIdentityServer

Repository files navigation

.NET CodeQL

Aspire for IdentityServer, Client & API

This sample includes:

  • A standard instance of IdentityServer from Duende using version 7.0.8 configured to use SQL Server storage.
  • An MVC client application setup to use PAR (pushed authorisation requests) and configured to use Redis cache.
  • A protected API resource, also configured to use Redis for output caching.
  • Serilog integration in the above projects, output to console.
  • Endpoint routing with MediatR.
  • Sample unit tests using Moq & FluentValidation.

Cloning and Building this project

Prerequisites

Before you start, make sure you have the following installed on your machine:

  • .NET 8 SDK: Download and install from the official .NET website.
  • IDE of Choice: Preferably Visual Studio for its robust support for .NET development. Alternatively, you can use Visual Studio Code or any other IDE that supports .NET.
  • Docker: Preferablly Docker Desktop, but any installation of Docker should work fine.

Customisations

  • Custom Options handler and types (ICustomOptions).
  • Customised HostingExtensions.cs (provides new ConfigureServices(), InitializeDatabase() and ConfigurePipeline() methods).
  • Custom WebApplicationBuilder extensions to provide configuration of IdentityServer and Redis.
  • Cleaned up Config.cs into SeedConfig.cs
  • Added Redis and SQL Server resources to the Aspire AppHost project for use in the IdentityServer application.
  • Endpoint routing with MediatR.

Steps to Clone and Build the Project

Important

If you do not already have the latest version of the Redis and MSSQL container images, it will take longer for them to provision, resulting in the IdentityServer project failing. Allow the SQL and Redis images to load, then if necessary, restart the Aspire solution.

  1. Clone the Repository:

    Open a terminal or command prompt and run the following command to clone the repository:

    git clone https://github.com/StuFrankish/AspireForIdentityServer.git
    cd AspireForIdentityServer
  2. Restore the Dependencies:

    Navigate to the project directory and restore the dependencies using the .NET CLI:

    dotnet restore
  3. Build the Project:

    Build the project using the .NET CLI:

    dotnet build
  4. Run the Project:

    To run the project, use the following command:

    dotnet run

    The application will start and open the Aspire dashboard in your default browser, where you should see the projects listed as well as the SQL & Redis containers begin to provision.

Contributing

If you'd like to contribute to the project, feel free to fork the repository, make your changes, and create a pull request.

For any further questions or issues, please open an issue on the GitHub repository.

About

Sample solution for a basic Identity Server & Client using Aspire orchestration

Topics

Resources

Stars

Watchers

Forks