Microsoft.AspNetCore.Authentication.OpenIdConnect 10.0.0-preview.3.25172.1

About

Microsoft.AspNetCore.Authentication.OpenIdConnect provides middleware that enables an application to support the OpenID Connect authentication workflow.

Key Features

  • Single sign-on and single sign-out support
  • Integration with external identity providers
  • Token validation and management
  • Configuration and mapping of user claims

How to Use

To use Microsoft.AspNetCore.Authentication.OpenIdConnect, follow these steps:

Installation

dotnet add package Microsoft.AspNetCore.Authentication.OpenIdConnect

Configuration

To configure Microsoft.AspNetCore.Authentication.OpenIdConnect, you need to add the necessary services and middleware to your application.

  1. In the Program.cs of your ASP.NET Core app, add the following code to register the OpenID Connect authentication services:

    builder.Services
        .AddAuthentication(options =>
        {
            options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
        })
        .AddCookie()
        .AddOpenIdConnect(options =>
        {
            // Configure the authentication options
            options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.Authority = "your-identity-provider";
            options.ClientId = "your-client-id";
            options.ClientSecret = "your-client-secret-from-user-secrets-or-keyvault";
            options.ResponseType = "code";
            options.Scope.Add("profile");
            options.SaveTokens = true;
        });
    

    Make sure to replace your-identity-provider, your-client-id, and your-client-secret-from-user-secrets-or-keyvault, with the appropriate values for your application and identity provider.

  2. Add the following code to enable the OpenID Connect authentication middleware:

    var app = builder.Build();
    
    app.UseAuthentication();
    

    This ensures that the authentication middleware is added to the request pipeline.

Main Types

The main types provided by Microsoft.AspNetCore.Authentication.OpenIdConnect are:

  • OpenIdConnectOptions: Represents the options for configuring the OpenID Connect authentication middleware
  • OpenIdConnectEvents: Provides event handlers for various stages of the OpenID Connect authentication workflow

For more information on these types and their usage, refer to the official documentation.

Additional Documentation

For additional documentation on using OpenID Connect authentication in ASP.NET Core, you can refer to the following resources:

Feedback & Contributing

Microsoft.AspNetCore.Authentication.OpenIdConnect is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.AspNetCore.Authentication.OpenIdConnect.

Packages Downloads
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
163
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
62
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
61
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
52
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
51
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
50
Microsoft.AspNetCore.Diagnostics.Identity.Service
ASP.NET Core Identity Service Diagnostics Middleware.
50
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
49
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
48
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
47
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
46
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
46
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
45
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
44
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
42
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
42
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
42
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
41
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
41

Version Downloads Last updated
10.0.0-preview.3.25172.1 4 04/11/2025
10.0.0-preview.2.25164.1 9 03/20/2025
10.0.0-preview.1.25120.3 12 02/25/2025
9.0.4 7 04/12/2025
9.0.3 10 03/15/2025
9.0.2 10 02/16/2025
9.0.1 12 01/20/2025
9.0.0 21 11/13/2024
9.0.0-rc.2.24474.3 20 10/19/2024
9.0.0-rc.1.24452.1 19 09/11/2024
9.0.0-preview.7.24406.2 23 08/13/2024
9.0.0-preview.6.24328.4 31 07/19/2024
9.0.0-preview.5.24306.11 24 06/13/2024
9.0.0-preview.4.24267.6 26 05/25/2024
9.0.0-preview.3.24172.13 26 04/13/2024
9.0.0-preview.2.24128.4 32 03/15/2024
9.0.0-preview.1.24081.5 25 02/24/2024
8.0.15 9 04/13/2025
8.0.14 12 03/15/2025
8.0.13 12 02/12/2025
8.0.12 14 01/25/2025
8.0.11 20 11/13/2024
8.0.10 20 10/19/2024
8.0.8 28 08/13/2024
8.0.7 30 07/11/2024
8.0.6 29 05/30/2024
8.0.5 25 05/14/2024
8.0.4 28 04/10/2024
8.0.3 29 03/15/2024
8.0.2 28 03/11/2024
8.0.1 27 01/17/2024
8.0.0 36 11/16/2023
8.0.0-rc.2.23480.2 40 10/22/2023
8.0.0-rc.1.23421.29 28 09/22/2023
8.0.0-preview.7.23375.9 32 08/25/2023
8.0.0-preview.6.23329.11 31 07/23/2023
8.0.0-preview.5.23302.2 35 06/20/2023
8.0.0-preview.4.23260.4 32 05/29/2023
8.0.0-preview.3.23177.8 29 06/30/2023
8.0.0-preview.2.23153.2 33 04/02/2023
8.0.0-preview.1.23112.2 32 02/22/2023
7.0.20 29 06/02/2024
7.0.19 25 05/14/2024
7.0.18 30 04/10/2024
7.0.17 32 03/13/2024
7.0.16 26 03/11/2024
7.0.15 28 01/17/2024
7.0.14 35 11/15/2023
7.0.13 39 10/26/2023
7.0.12 29 10/28/2023
7.0.11 33 09/21/2023
7.0.10 31 08/29/2023
7.0.9 33 07/23/2023
7.0.8 37 07/11/2023
7.0.7 41 06/20/2023
7.0.5 35 06/11/2023
7.0.4 38 04/28/2023
7.0.3 37 04/09/2023
7.0.2 34 01/17/2023
7.0.1 37 12/23/2022
7.0.0 39 12/23/2022
7.0.0-rc.2.22476.2 34 06/30/2023
7.0.0-rc.1.22427.2 35 11/21/2022
7.0.0-preview.7.22376.6 38 11/15/2022
7.0.0-preview.6.22330.3 32 07/01/2023
7.0.0-preview.5.22303.8 40 11/09/2022
7.0.0-preview.4.22251.1 49 06/19/2022
7.0.0-preview.3.22178.4 38 07/19/2022
7.0.0-preview.2.22153.2 35 11/05/2022
7.0.0-preview.1.22109.13 30 06/11/2023
6.0.36 25 11/13/2024
6.0.35 21 10/19/2024
6.0.33 25 08/14/2024
6.0.32 22 07/11/2024
6.0.31 32 06/02/2024
6.0.30 25 05/14/2024
6.0.29 26 04/10/2024
6.0.28 32 03/15/2024
6.0.27 27 03/11/2024
6.0.26 25 01/17/2024
6.0.25 34 11/16/2023
6.0.24 32 10/26/2023
6.0.23 34 10/23/2023
6.0.22 26 09/21/2023
6.0.21 32 08/26/2023
6.0.20 34 07/24/2023
6.0.19 29 07/06/2023
6.0.18 38 06/20/2023
6.0.16 36 05/15/2023
6.0.15 38 04/25/2023
6.0.14 34 06/25/2023
6.0.13 30 04/02/2023
6.0.12 33 12/23/2022
6.0.11 32 12/23/2022
6.0.10 33 12/23/2022
6.0.9 38 01/14/2023
6.0.8 50 11/11/2022
6.0.7 40 02/26/2023
6.0.6 32 12/26/2022
6.0.5 45 09/16/2022
6.0.4 35 11/27/2022
6.0.3 31 10/27/2022
6.0.2 39 12/14/2022
6.0.1 32 12/21/2021
6.0.0 37 07/03/2022
6.0.0-rc.2.21480.10 34 06/29/2023
6.0.0-rc.1.21452.15 32 12/28/2022
6.0.0-preview.7.21378.6 36 12/26/2022
6.0.0-preview.6.21355.2 32 12/02/2022
6.0.0-preview.5.21301.17 36 05/24/2023
6.0.0-preview.4.21253.5 30 05/11/2023
6.0.0-preview.3.21201.13 36 06/28/2023
6.0.0-preview.2.21154.6 32 11/16/2022
6.0.0-preview.1.21103.6 29 11/15/2022
5.0.17 36 11/24/2022
5.0.16 36 11/24/2022
5.0.15 36 12/21/2022
5.0.14 41 12/12/2022
5.0.13 41 10/04/2022
5.0.12 33 12/30/2022
5.0.11 39 12/16/2022
5.0.10 37 11/28/2022
5.0.9 34 12/24/2022
5.0.8 56 10/10/2022
5.0.7 32 11/15/2022
5.0.6 33 10/29/2022
5.0.5 33 10/28/2022
5.0.4 35 11/27/2022
5.0.3 36 12/17/2022
5.0.2 40 12/21/2022
5.0.1 50 11/18/2022
5.0.0 42 12/21/2022
5.0.0-rc.2.20475.17 31 11/08/2022
5.0.0-rc.1.20451.17 27 06/29/2023
5.0.0-preview.8.20414.8 39 12/03/2022
5.0.0-preview.7.20365.19 35 06/29/2023
5.0.0-preview.6.20312.15 29 11/28/2022
5.0.0-preview.5.20279.2 30 06/29/2023
5.0.0-preview.4.20257.10 28 06/23/2023
5.0.0-preview.3.20215.14 35 06/28/2023
5.0.0-preview.2.20167.3 38 12/30/2022
5.0.0-preview.1.20124.5 35 10/10/2022
3.1.32 39 12/23/2022
3.1.31 33 02/20/2023
3.1.30 35 04/04/2023
3.1.29 36 12/18/2022
3.1.28 34 12/21/2022
3.1.27 32 12/24/2022
3.1.26 39 03/31/2023
3.1.25 40 11/10/2022
3.1.24 32 12/24/2022
3.1.23 38 01/08/2023
3.1.22 44 10/13/2022
3.1.21 31 11/10/2022
3.1.20 37 10/31/2022
3.1.19 47 08/01/2022
3.1.18 40 12/23/2022
3.1.17 33 01/15/2023
3.1.16 34 02/27/2023
3.1.15 40 11/08/2022
3.1.14 38 06/24/2022
3.1.13 54 01/03/2022
3.1.12 33 11/18/2022
3.1.11 35 12/16/2022
3.1.10 35 11/06/2022
3.1.9 34 12/26/2022
3.1.8 33 12/21/2022
3.1.7 49 06/29/2022
3.1.6 38 11/24/2022
3.1.5 37 11/08/2022
3.1.4 42 11/26/2022
3.1.3 37 09/30/2022
3.1.2 38 08/08/2022
3.1.1 31 12/10/2022
3.1.0 59 11/09/2020
3.1.0-preview3.19555.2 31 06/30/2023
3.1.0-preview2.19528.8 28 05/05/2023
3.1.0-preview1.19508.20 30 06/16/2022
3.0.3 41 10/20/2022
3.0.2 45 11/08/2022
3.0.0 36 09/02/2022
3.0.0-rc1.19457.4 28 06/24/2023
3.0.0-preview9.19424.4 37 11/13/2022
3.0.0-preview8.19405.7 35 06/30/2023
3.0.0-preview7.19365.7 35 06/27/2023
3.0.0-preview6.19307.2 40 06/29/2023
3.0.0-preview5-19227-01 31 02/17/2023
3.0.0-preview4-19216-03 42 12/13/2022
3.0.0-preview3-19153-02 39 09/30/2022
3.0.0-preview-19075-0444 34 12/11/2022
2.3.0 13 01/19/2025
2.2.0 43 11/05/2022
2.2.0-preview3-35497 41 07/18/2022
2.2.0-preview2-35157 36 06/28/2023
2.2.0-preview1-35029 34 12/17/2022
2.1.2 39 12/18/2022
2.1.1 44 07/02/2022
2.1.0 40 12/30/2022
2.1.0-rc1-final 35 12/17/2022
2.1.0-preview2-final 30 11/10/2022
2.1.0-preview1-final 41 11/13/2022
2.0.4 39 12/30/2022
2.0.3 35 12/30/2022
2.0.1 31 11/25/2022
2.0.0 41 12/15/2022
2.0.0-preview2-final 44 01/22/2023
2.0.0-preview1-final 39 07/10/2022
1.1.3 39 11/16/2022
1.1.2 45 11/13/2022
1.1.1 37 12/18/2022
1.1.0 44 12/15/2022
1.1.0-preview1-final 30 02/04/2023
1.0.5 43 11/21/2022
1.0.4 36 11/14/2022
1.0.3 38 12/16/2022
1.0.2 32 10/31/2022
1.0.1 37 12/05/2022
1.0.0 48 07/04/2022
1.0.0-rc2-final 33 07/27/2022