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.
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.
- Custom Options handler and types (
ICustomOptions
). - Customised
HostingExtensions.cs
(provides newConfigureServices()
,InitializeDatabase()
andConfigurePipeline()
methods). - Custom
WebApplicationBuilder
extensions to provide configuration of IdentityServer and Redis. - Cleaned up
Config.cs
intoSeedConfig.cs
- Added Redis and SQL Server resources to the Aspire AppHost project for use in the IdentityServer application.
- Endpoint routing with MediatR.
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.
-
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
-
Restore the Dependencies:
Navigate to the project directory and restore the dependencies using the .NET CLI:
dotnet restore
-
Build the Project:
Build the project using the .NET CLI:
dotnet build
-
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.
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.