Compare commits
No commits in common. "56846e278104cba08e2f535057252501b2e334d4" and "fdb7acca567c2a720a8526184b6de482b0a737a4" have entirely different histories.
56846e2781
...
fdb7acca56
2 changed files with 5 additions and 22 deletions
|
|
@ -34,7 +34,7 @@ request:
|
|||
source: access_token
|
||||
settings:
|
||||
autoFetchToken: true
|
||||
autoRefreshToken: true
|
||||
autoRefreshToken: false
|
||||
bundled: false
|
||||
extensions:
|
||||
bruno:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ internal class Program
|
|||
Console.Title = "Yavsc.Blogs";
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.AddConfiguration("blogs");
|
||||
|
||||
var services = builder.Services;
|
||||
|
|
@ -36,23 +37,10 @@ internal class Program
|
|||
})
|
||||
.AddYavscCors(builder.Configuration)
|
||||
.AddControllers();
|
||||
String authority = builder.Configuration.GetValue<string>("Site:Authority");
|
||||
String audience = builder.Configuration.GetValue<string>("Site:Audience");
|
||||
if (string.IsNullOrEmpty(authority))
|
||||
{
|
||||
throw new Exception("Site:Authority is not configured in appsettings.json");
|
||||
}
|
||||
|
||||
|
||||
// AuthenticationBuilder
|
||||
services.AddAuthentication("Bearer")
|
||||
.AddYavscJwtBearer(builder.Configuration,
|
||||
options =>
|
||||
{
|
||||
options.Authority = authority;
|
||||
options.Audience = builder.Configuration.GetValue<string>
|
||||
("Site:Audience");
|
||||
});
|
||||
.AddYavscJwtBearer(builder.Configuration);
|
||||
|
||||
// DbContextBuilder
|
||||
services.AddDbContext<ApplicationDbContext>(options =>
|
||||
|
|
@ -93,20 +81,15 @@ internal class Program
|
|||
{
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
app
|
||||
.UseRouting()
|
||||
.UseAuthentication()
|
||||
.UseAuthorization()
|
||||
.UseCors("default")
|
||||
;
|
||||
app.Services.GetRequiredService<ILoggerFactory>().CreateLogger("Program")
|
||||
.LogInformation($"Yavsc.Blogs started, Authority is '{authority}', Audience is '{audience}'");
|
||||
app.MapControllers();
|
||||
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("BlogScope")
|
||||
.WithHttpLogging(Microsoft.AspNetCore.HttpLogging.HttpLoggingFields.All)
|
||||
.WithTags("Identity")
|
||||
.WithDescription("Identity API for Yavsc.Blogs")
|
||||
.WithMetadata(new ApiExplorerSettingsAttribute { GroupName = "Identity" });
|
||||
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("BlogScope");
|
||||
|
||||
app.UseSession();
|
||||
await app.RunAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue