Browse Source

Created DefaultChallengeScheme on CAP.DashboardOptions.cs to specify dashboard auth challenge scheme (#815)

master
Mateus Viegas 3 years ago
committed by GitHub
parent
commit
b7649308b2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions
  1. +1
    -0
      samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs
  2. +1
    -1
      src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs
  3. +6
    -0
      src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs

+ 1
- 0
samples/Sample.RabbitMQ.Postgres.DashboardAuth/Startup.cs View File

@@ -62,6 +62,7 @@ namespace Sample.RabbitMQ.Postgres.DashboardAuth
cap.UseDashboard(d => cap.UseDashboard(d =>
{ {
d.UseChallengeOnAuth = true; d.UseChallengeOnAuth = true;
d.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
d.Authorization = new[] {new HttpContextDashboardFilter()}; d.Authorization = new[] {new HttpContextDashboardFilter()};
}); });
}); });


+ 1
- 1
src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs View File

@@ -136,7 +136,7 @@ namespace DotNetCore.CAP


if (_options.UseChallengeOnAuth) if (_options.UseChallengeOnAuth)
{ {
await context.ChallengeAsync();
await context.ChallengeAsync(_options.DefaultChallengeScheme);
return; return;
} }




+ 6
- 0
src/DotNetCore.CAP.Dashboard/CAP.DashboardOptions.cs View File

@@ -3,6 +3,7 @@


using System.Collections.Generic; using System.Collections.Generic;
using DotNetCore.CAP.Dashboard; using DotNetCore.CAP.Dashboard;
using Microsoft.AspNetCore.Authentication.Cookies;


// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
namespace DotNetCore.CAP namespace DotNetCore.CAP
@@ -18,6 +19,11 @@ namespace DotNetCore.CAP
UseChallengeOnAuth = false; UseChallengeOnAuth = false;
} }


/// <summary>
/// Default ChallengeScheme used for Dashboard authentication. If no scheme is set, the DefaultScheme set up in AddAuthentication will be used.
/// </summary>
public string DefaultChallengeScheme { get; set; }
/// <summary> /// <summary>
/// Indicates if executes a Challenge for Auth within ASP.NET middlewares /// Indicates if executes a Challenge for Auth within ASP.NET middlewares
/// </summary> /// </summary>


Loading…
Cancel
Save