diff --git a/samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs b/samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs index 481dcbb..4375f15 100644 --- a/samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs +++ b/samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs @@ -62,6 +62,7 @@ namespace Sample.RabbitMQ.Postgres.DashboardAuth cap.UseDashboard(d => { d.UseChallengeOnAuth = true; + d.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; d.Authorization = new[] {new HttpContextDashboardFilter()}; }); }); diff --git a/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs b/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs index 441fcf3..8fe2145 100644 --- a/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs +++ b/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs @@ -136,7 +136,7 @@ namespace DotNetCore.CAP if (_options.UseChallengeOnAuth) { - await context.ChallengeAsync(); + await context.ChallengeAsync(_options.DefaultChallengeScheme); return; } diff --git a/src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs b/src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs index aec1f0d..f65937e 100644 --- a/src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs +++ b/src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using DotNetCore.CAP.Dashboard; +using Microsoft.AspNetCore.Authentication.Cookies; // ReSharper disable once CheckNamespace namespace DotNetCore.CAP @@ -18,6 +19,11 @@ namespace DotNetCore.CAP UseChallengeOnAuth = false; } + /// + /// Default ChallengeScheme used for Dashboard authentication. If no scheme is set, the DefaultScheme set up in AddAuthentication will be used. + /// + public string DefaultChallengeScheme { get; set; } + /// /// Indicates if executes a Challenge for Auth within ASP.NET middlewares ///