blogs: use centralized JWT audience handling
This commit is contained in:
parent
1b0933c215
commit
b1e8d37f21
1 changed files with 3 additions and 16 deletions
|
|
@ -43,22 +43,9 @@ internal class Program
|
||||||
throw new Exception("Site:Authority is not configured in appsettings.json");
|
throw new Exception("Site:Authority is not configured in appsettings.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (var audience in builder.Configuration.GetValue<string[]>("Site:Audience"))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(audience))
|
|
||||||
{
|
|
||||||
throw new Exception("Site:Audience is not configured in appsettings.json");
|
|
||||||
}
|
|
||||||
// AuthenticationBuilder
|
// AuthenticationBuilder
|
||||||
services.AddAuthentication("Bearer")
|
services.AddAuthentication("Bearer")
|
||||||
.AddYavscJwtBearer(builder.Configuration,
|
.AddYavscJwtBearer(builder.Configuration);
|
||||||
options =>
|
|
||||||
{
|
|
||||||
options.Authority = authority;
|
|
||||||
options.Audience = audience;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// DbContextBuilder
|
// DbContextBuilder
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue