ASP.NET Core Identity automatically supports cookie authentication. It is also straightforward to support authentication by external providers using the Google, Facebook, or Twitter ASP.NET Core authentication packages. One authentication scenario that requires a little bit more work, though, is to authenticate via bearer tokens. I recently worked with a customer who was interested in using JWT bearer tokens for authentication in mobile apps that worked with an ASP.NET Core back-end. Because some of their customers do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace TilePuzzle | |
{ | |
enum TileColors { Red, Blue, Yellow, Green } | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ItemGroup> | |
<PackageReference Include="Castle.Windsor"> | |
<Version>4.1.1</Version> | |
</PackageReference> | |
<PackageReference Include="MahApps.Metro"> | |
<Version>1.6.5</Version> | |
</PackageReference> | |
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers"> | |
<Version>2.9.2</Version> | |
</PackageReference> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) | |
{ | |
var context = serviceScope.ServiceProvider.GetService<MyContext>(); | |
if (context.Database.EnsureCreated()) | |
{ | |
context.SeedData(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The middleware delegate to call after this one finishes processing | |
private readonly RequestDelegate _next; | |
public SOAPEndpointMiddleware(RequestDelegate next) | |
{ | |
_next = next; | |
} |