Task <Response> CheckOwinContext(NancyContext context, CancellationToken token) { var principal = context.GetOwinPrincipal(); if (principal != null && principal.Identity.IsAuthenticated) { context.CurrentUser = new ClaimsUserIdentity(principal); } return(Task.FromResult <Response>(null)); }