Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Jamie Smith jsmithedin

:octocat:
View GitHub Profile
@jsmithedin
jsmithedin / startup.cs
Created Jan 10, 2018
ASP.Net Core 2.0 - Include Configuration
View startup.cs
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
@jsmithedin
jsmithedin / startup.cs
Last active Feb 10, 2018
ASP.Net Core 2.0 - Configure JWT Auth - startup.cs
View startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(
@jsmithedin
jsmithedin / authentication.cs
Created Jan 10, 2018
ASP.Net Core 2.0 - Require Authentication
View authentication.cs
[Authorize]
[Route("api")]
public class ApiController : Controller
{
[HttpGet("Test")]
public IActionResult Test()
{
return Ok("Content secured with Approov Token");
}