Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename variable to reflect the context better #215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void ConfigureServices(IServiceCollection services)

var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
const string connectionString = @"Data Source=Duende.IdentityServer.Quickstart.EntityFramework-5.0.0.db";

var builder = services.AddIdentityServer()
.AddTestUsers(TestUsers.Users)
.AddConfigurationStore(options =>
Expand Down Expand Up @@ -116,9 +116,9 @@ private void InitializeDatabase(IApplicationBuilder app)

if (!context.ApiScopes.Any())
{
foreach (var resource in Config.ApiScopes)
foreach (var apiScope in Config.ApiScopes)
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand All @@ -67,9 +67,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiResources.Any())
{
Log.Debug("ApiResources being populated");
foreach (var resource in Config.ApiResources.ToList())
foreach (var apiScope in Config.ApiResources.ToList())
{
context.ApiResources.Add(resource.ToEntity());
context.ApiResources.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ private static void InitializeDatabase(IApplicationBuilder app)

if (!context.ApiScopes.Any())
{
foreach (var resource in Config.ApiScopes)
foreach (var apiScope in Config.ApiScopes)
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down Expand Up @@ -95,9 +95,9 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde

return builder.Build();
}

public static WebApplication ConfigurePipeline(this WebApplication app)
{
{
app.UseSerilogRequestLogging();
if (app.Environment.IsDevelopment())
{
Expand All @@ -108,7 +108,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)

app.UseStaticFiles();
app.UseRouting();

app.UseIdentityServer();

app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ private static void InitializeDatabase(IApplicationBuilder app)

if (!context.ApiScopes.Any())
{
foreach (var resource in Config.ApiScopes)
foreach (var apiScope in Config.ApiScopes)
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down Expand Up @@ -84,7 +84,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
options.ClientSecret = googleClientSecret;
});
}

authenticationBuilder.AddOpenIdConnect("oidc", "Demo IdentityServer", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
Expand All @@ -105,11 +105,11 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde

return builder.Build();
}

public static WebApplication ConfigurePipeline(this WebApplication app)
{
{
app.UseSerilogRequestLogging();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand All @@ -119,7 +119,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)

app.UseStaticFiles();
app.UseRouting();

app.UseIdentityServer();

app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private static void EnsureSeedData(ConfigurationDbContext context)
if (!context.ApiScopes.Any())
{
Log.Debug("ApiScopes being populated");
foreach (var resource in Config.ApiScopes.ToList())
foreach (var apiScope in Config.ApiScopes.ToList())
{
context.ApiScopes.Add(resource.ToEntity());
context.ApiScopes.Add(apiScope.ToEntity());
}
context.SaveChanges();
}
Expand Down