In ASP.NET 5 MVC 6 RC1 how do I retrieve AuthenticationProperties
from within a controller or from a filter? HttpContext.Authentication
does\'t seem to
In ASP.NET 5, retrieving the authentication properties is a bit cumbersome as it must be done by instantiating an AuthenticateContext
:
var context = new AuthenticateContext("[your authentication scheme]");
await HttpContext.Authentication.AuthenticateAsync(context);
if (context.Principal == null || context.Properties == null) {
throw new InvalidOperationException("The request is not authenticated.");
}
var properties = new AuthenticationProperties(context.Properties);