Apply formatting to remaining unformatted files

This commit is contained in:
Neil Brommer 2021-11-22 14:57:51 -08:00
parent 57953fd509
commit c53d7b8ce3
10 changed files with 145 additions and 147 deletions

View file

@ -4,7 +4,7 @@ root = true
insert_final_newline = true insert_final_newline = true
max_line_length = 100 max_line_length = 100
[*.{cs,cshtml,html,xml,js,css,csproj}] [*.{cs,cshtml,html,xml,js,css,csproj,json}]
indent_style = tab indent_style = tab
tab_width = 4 tab_width = 4
trim_trailing_whitespace = true trim_trailing_whitespace = true

View file

@ -6,30 +6,41 @@
@{ @{
var returnUrl = "/"; var returnUrl = "/";
if (Context.Request.Query.TryGetValue("returnUrl", out var existingUrl)) { if (Context.Request.Query.TryGetValue("returnUrl", out var existingUrl))
{
returnUrl = existingUrl; returnUrl = existingUrl;
} }
} }
<ul class="navbar-nav"> <ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User)) @if (SignInManager.IsSignedIn(User))
{ {
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity?.Name!</a> <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index"
</li> title="Manage">
<li class="nav-item"> Hello @User.Identity?.Name!
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post"> </a>
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button> </li>
</form> <li class="nav-item">
</li> <form class="form-inline" asp-area="Identity" asp-page="/Account/Logout"
} asp-route-returnUrl="/" method="post">
else <button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
{ </form>
<li class="nav-item"> </li>
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register" asp-route-returnUrl="@returnUrl">Register</a> }
</li> else
<li class="nav-item"> {
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login" asp-route-returnUrl="@returnUrl">Login</a> <li class="nav-item">
</li> <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register"
} asp-route-returnUrl="@returnUrl">
Register
</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login"
asp-route-returnUrl="@returnUrl">
Login
</a>
</li>
}
</ul> </ul>

View file

@ -2,25 +2,23 @@ using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Start.Server.Controllers namespace Start.Server.Controllers {
{ public class OidcConfigurationController : Controller {
public class OidcConfigurationController : Controller private readonly ILogger<OidcConfigurationController> _logger;
{
private readonly ILogger<OidcConfigurationController> _logger;
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger) public OidcConfigurationController(
{ IClientRequestParametersProvider clientRequestParametersProvider,
ClientRequestParametersProvider = clientRequestParametersProvider; ILogger<OidcConfigurationController> logger) {
_logger = logger; ClientRequestParametersProvider = clientRequestParametersProvider;
} _logger = logger;
}
public IClientRequestParametersProvider ClientRequestParametersProvider { get; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
[HttpGet("_configuration/{clientId}")] [HttpGet("_configuration/{clientId}")]
public IActionResult GetClientRequestParameters([FromRoute] string clientId) public IActionResult GetClientRequestParameters([FromRoute] string clientId) {
{ var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters);
return Ok(parameters); }
} }
}
} }

View file

@ -7,36 +7,31 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Start.Shared; using Start.Shared;
namespace Start.Server.Controllers namespace Start.Server.Controllers {
{ [Authorize]
[Authorize] [ApiController]
[ApiController] [Route("[controller]")]
[Route("[controller]")] public class WeatherForecastController : ControllerBase {
public class WeatherForecastController : ControllerBase private static readonly string[] Summaries = new[]
{ {
private static readonly string[] Summaries = new[] "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
{ };
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger; private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger) public WeatherForecastController(ILogger<WeatherForecastController> logger) {
{ _logger = logger;
_logger = logger; }
}
[HttpGet] [HttpGet]
public IEnumerable<WeatherForecast> Get() public IEnumerable<WeatherForecast> Get() {
{ var rng = new Random();
var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast {
return Enumerable.Range(1, 5).Select(index => new WeatherForecast Date = DateTime.Now.AddDays(index),
{ TemperatureC = rng.Next(-20, 55),
Date = DateTime.Now.AddDays(index), Summary = Summaries[rng.Next(Summaries.Length)]
TemperatureC = rng.Next(-20, 55), })
Summary = Summaries[rng.Next(Summaries.Length)] .ToArray();
}) }
.ToArray(); }
}
}
} }

View file

@ -4,10 +4,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Start.Server.Models namespace Start.Server.Models {
{ public class ApplicationUser : IdentityUser {
public class ApplicationUser : IdentityUser
{
/// <summary>The <see cref="BookmarkContainer"/>s that belong to this user</summary> /// <summary>The <see cref="BookmarkContainer"/>s that belong to this user</summary>
public List<BookmarkContainer>? BookmarkContainers { get; set; } public List<BookmarkContainer>? BookmarkContainers { get; set; }
} }

View file

@ -7,20 +7,16 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Start.Server namespace Start.Server {
{ public class Program {
public class Program public static void Main(string[] args) {
{ CreateHostBuilder(args).Build().Run();
public static void Main(string[] args) }
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) => public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args) Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => .ConfigureWebHostDefaults(webBuilder => {
{ webBuilder.UseStartup<Startup>();
webBuilder.UseStartup<Startup>(); });
}); }
}
} }

View file

@ -1,30 +1,30 @@
{ {
"iisSettings": { "iisSettings": {
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:14780", "applicationUrl": "http://localhost:14780",
"sslPort": 44310 "sslPort": 44310
} }
}, },
"profiles": { "profiles": {
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
"launchBrowser": true, "launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"Start.Server": { "Start.Server": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": "true", "dotnetRunMessages": "true",
"launchBrowser": true, "launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
} }
} }
} }

View file

@ -1,14 +1,14 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft": "Warning", "Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"IdentityServer": { "IdentityServer": {
"Key": { "Key": {
"Type": "Development" "Type": "Development"
} }
} }
} }

View file

@ -1,20 +1,20 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "DataSource=app.db" "DefaultConnection": "DataSource=app.db"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft": "Warning", "Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"IdentityServer": { "IdentityServer": {
"Clients": { "Clients": {
"Start.Client": { "Start.Client": {
"Profile": "IdentityServerSPA" "Profile": "IdentityServerSPA"
} }
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*"
} }