Skip to content

Commit 9a482c1

Browse files
committed
Fixed formatting
1 parent 4bcb0d8 commit 9a482c1

File tree

22 files changed

+152
-152
lines changed

22 files changed

+152
-152
lines changed

samples/SampleWebApi.Shared/Repositories/IApiKeyRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace SampleWebApi.Repositories
77
/// NOTE: DO NOT USE THIS IMPLEMENTATION. THIS IS FOR DEMO PURPOSE ONLY
88
/// </summary>
99
public interface IApiKeyRepository
10-
{
11-
Task<IApiKey> GetApiKeyAsync(string key);
12-
}
10+
{
11+
Task<IApiKey> GetApiKeyAsync(string key);
12+
}
1313
}

samples/SampleWebApi.Shared/Repositories/InMemoryApiKeyRepository.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace SampleWebApi.Repositories
99
{
10-
/// <summary>
11-
/// NOTE: DO NOT USE THIS IMPLEMENTATION. THIS IS FOR DEMO PURPOSE ONLY
12-
/// </summary>
13-
public class InMemoryApiKeyRepository : IApiKeyRepository
10+
/// <summary>
11+
/// NOTE: DO NOT USE THIS IMPLEMENTATION. THIS IS FOR DEMO PURPOSE ONLY
12+
/// </summary>
13+
public class InMemoryApiKeyRepository : IApiKeyRepository
1414
{
1515
private List<IApiKey> _cache = new List<IApiKey>
1616
{

samples/SampleWebApi.Shared/Services/ApiKeyProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace SampleWebApi.Services
77
{
8-
class ApiKeyProvider : IApiKeyProvider
8+
class ApiKeyProvider : IApiKeyProvider
99
{
1010
private readonly ILogger<IApiKeyProvider> _logger;
1111
private readonly IApiKeyRepository _apiKeyRepository;

samples/SampleWebApi_2_0/Controllers/ValuesController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SampleWebApi_2_2.Controllers
66
{
7-
[Route("api/[controller]")]
7+
[Route("api/[controller]")]
88
public class ValuesController : ControllerBase
99
{
1010
// GET api/values
@@ -16,14 +16,14 @@ public IEnumerable<string> Get()
1616

1717
[HttpGet("claims")]
1818
public string Claims()
19-
{
19+
{
2020
var sb = new StringBuilder();
21-
foreach (var claim in User.Claims)
22-
{
21+
foreach (var claim in User.Claims)
22+
{
2323
sb.AppendLine($"{claim.Type}: {claim.Value}");
24-
}
24+
}
2525
return sb.ToString();
26-
}
26+
}
2727

2828
[HttpGet("forbid")]
2929
public new IActionResult Forbid()

samples/SampleWebApi_2_0/Startup.cs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
namespace SampleWebApi
1818
{
1919
public class Startup
20-
{
21-
public Startup(IConfiguration configuration)
22-
{
23-
Configuration = configuration;
24-
}
20+
{
21+
public Startup(IConfiguration configuration)
22+
{
23+
Configuration = configuration;
24+
}
2525

26-
public IConfiguration Configuration { get; }
26+
public IConfiguration Configuration { get; }
2727

28-
// This method gets called by the runtime. Use this method to add services to the container.
29-
public void ConfigureServices(IServiceCollection services)
30-
{
31-
// Add User repository to the dependency container.
32-
services.AddTransient<IApiKeyRepository, InMemoryApiKeyRepository>();
28+
// This method gets called by the runtime. Use this method to add services to the container.
29+
public void ConfigureServices(IServiceCollection services)
30+
{
31+
// Add User repository to the dependency container.
32+
services.AddTransient<IApiKeyRepository, InMemoryApiKeyRepository>();
3333

3434
// Add the ApiKey scheme authentication here..
3535
// It requires Realm to be set in the options if SuppressWWWAuthenticateHeader is not set.
@@ -150,32 +150,32 @@ public void ConfigureServices(IServiceCollection services)
150150
});
151151

152152
services.AddMvc(options =>
153-
{
154-
// ALWAYS USE HTTPS (SSL) protocol in production when using ApiKey authentication.
155-
//options.Filters.Add<RequireHttpsAttribute>();
156-
157-
// All the requests will need to be authorized.
158-
// Alternatively, add [Authorize] attribute to Controller or Action Method where necessary.
159-
options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));
160-
}
161-
); //.AddXmlSerializerFormatters(); // To enable XML along with JSON
162-
}
163-
164-
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
165-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
166-
{
167-
if (env.IsDevelopment())
168-
{
169-
app.UseDeveloperExceptionPage();
170-
}
171-
else
172-
{
173-
// ALWAYS USE HTTPS (SSL) protocol in production when using ApiKey authentication.
174-
app.UseRewriter(new RewriteOptions().AddRedirectToHttpsPermanent());
175-
}
176-
177-
app.UseAuthentication();
178-
app.UseMvc();
179-
}
180-
}
153+
{
154+
// ALWAYS USE HTTPS (SSL) protocol in production when using ApiKey authentication.
155+
//options.Filters.Add<RequireHttpsAttribute>();
156+
157+
// All the requests will need to be authorized.
158+
// Alternatively, add [Authorize] attribute to Controller or Action Method where necessary.
159+
options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));
160+
}
161+
); //.AddXmlSerializerFormatters(); // To enable XML along with JSON
162+
}
163+
164+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
165+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
166+
{
167+
if (env.IsDevelopment())
168+
{
169+
app.UseDeveloperExceptionPage();
170+
}
171+
else
172+
{
173+
// ALWAYS USE HTTPS (SSL) protocol in production when using ApiKey authentication.
174+
app.UseRewriter(new RewriteOptions().AddRedirectToHttpsPermanent());
175+
}
176+
177+
app.UseAuthentication();
178+
app.UseMvc();
179+
}
180+
}
181181
}

samples/SampleWebApi_2_2/Controllers/ValuesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SampleWebApi_2_2.Controllers
66
{
7-
[Route("api/[controller]")]
7+
[Route("api/[controller]")]
88
[ApiController]
99
public class ValuesController : ControllerBase
1010
{

samples/SampleWebApi_2_2/Startup.cs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
namespace SampleWebApi_2_2
1818
{
1919
public class Startup
20-
{
21-
public Startup(IConfiguration configuration)
22-
{
23-
Configuration = configuration;
24-
}
20+
{
21+
public Startup(IConfiguration configuration)
22+
{
23+
Configuration = configuration;
24+
}
2525

26-
public IConfiguration Configuration { get; }
26+
public IConfiguration Configuration { get; }
2727

28-
// This method gets called by the runtime. Use this method to add services to the container.
29-
public void ConfigureServices(IServiceCollection services)
30-
{
28+
// This method gets called by the runtime. Use this method to add services to the container.
29+
public void ConfigureServices(IServiceCollection services)
30+
{
3131
// Add User repository to the dependency container.
3232
services.AddTransient<IApiKeyRepository, InMemoryApiKeyRepository>();
3333

@@ -150,34 +150,34 @@ public void ConfigureServices(IServiceCollection services)
150150
});
151151

152152
services.AddMvc(options =>
153-
{
154-
// ALWAYS USE HTTPS (SSL) protocol in production when using Basic authentication.
155-
//options.Filters.Add<RequireHttpsAttribute>();
156-
157-
// All the requests will need to be authorized.
158-
// Alternatively, add [Authorize] attribute to Controller or Action Method where necessary.
159-
options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));
160-
})
161-
//.AddXmlSerializerFormatters() // To enable XML along with JSON
162-
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
163-
}
164-
165-
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
166-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
167-
{
168-
if (env.IsDevelopment())
169-
{
170-
app.UseDeveloperExceptionPage();
171-
}
172-
else
173-
{
174-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
175-
app.UseHsts();
176-
}
177-
178-
app.UseHttpsRedirection();
179-
app.UseAuthentication();
180-
app.UseMvc();
181-
}
182-
}
153+
{
154+
// ALWAYS USE HTTPS (SSL) protocol in production when using Basic authentication.
155+
//options.Filters.Add<RequireHttpsAttribute>();
156+
157+
// All the requests will need to be authorized.
158+
// Alternatively, add [Authorize] attribute to Controller or Action Method where necessary.
159+
options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));
160+
})
161+
//.AddXmlSerializerFormatters() // To enable XML along with JSON
162+
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
163+
}
164+
165+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
166+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
167+
{
168+
if (env.IsDevelopment())
169+
{
170+
app.UseDeveloperExceptionPage();
171+
}
172+
else
173+
{
174+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
175+
app.UseHsts();
176+
}
177+
178+
app.UseHttpsRedirection();
179+
app.UseAuthentication();
180+
app.UseMvc();
181+
}
182+
}
183183
}

samples/SampleWebApi_3_1/Controllers/ValuesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SampleWebApi_3_1.Controllers
66
{
7-
[Route("api/[controller]")]
7+
[Route("api/[controller]")]
88
[ApiController]
99
public class ValuesController : ControllerBase
1010
{

samples/SampleWebApi_3_1/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
184184

185185
app.UseHttpsRedirection();
186186
app.UseRouting();
187-
187+
188188
app.UseAuthentication(); // NOTE: DEFAULT TEMPLATE DOES NOT HAVE THIS, THIS LINE IS REQUIRED AND HAS TO BE ADDED!!!
189189

190190
app.UseAuthorization();

samples/SampleWebApi_5_0/Controllers/ValuesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SampleWebApi_5_0.Controllers
66
{
7-
[Route("api/[controller]")]
7+
[Route("api/[controller]")]
88
[ApiController]
99
public class ValuesController : ControllerBase
1010
{

0 commit comments

Comments
 (0)