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