Peter Morlion logo

Generating a JWT in .NET 4.5.2

I recently had to generate a JSON Web Token (JWT) as a response from an login request to an api. The idea is to POST the user’s credentials from a mobile app, and to respond with a JWT. The mobile app can then verify that the user has logged in correctly. A quick introduction to […]

Integration testing in-memory WebAPI with Autofac

Continuing on my previous post on WebAPI, Autofac and filters, I now want to add an integration test. Unit testing WebAPI controllers is no different than testing other pieces of code. Just inject mocks in the constructor and you’re good to go. Integration testing can be as simple, if you’re not using filters. The filters […]

Autofac, Web API and filters

A short post with a small, useful tip. It’s mainly for my future self, but may be good to know for you too. If you’re using ASP.NET Web API, you might have controllers that look like this: public class CustomerController : ApiController { private readonly ILog _log; public CustomerController(ILog log) { _log = log; } […]

Posting to ASP.NET 5 WebAPI Controller from Aurelia

A small post for my own reference, and yours if you need it. It took me a while to get this working. In ASP.NET 5, the WebAPI Controller is no longer the same as the WebAPI 2 Controllers we’re used to. These Controllers are quite specific on how they accept content. Aurelia has an easy […]