Get AuthenticationInfo in ASP.NET Core 2.0

Viewed 7959

How do I get the AuthenticationInfo property from the HttpContext in ASP.NET Core 2.0. I understand that with the redesign of Security in ASP.NET Core 2.0 the AuthenticationManager is now obsolete and that I should remove .Authentication.

I used to do something like this in 1.1.2

var info = await httpContext.Authentication.GetAuthenticateInfoAsync("Automatic");
info.Properties.StoreTokens(new List<AuthenticationToken>
{
    new AuthenticationToken
    {
        Name = OpenIdConnectParameterNames.AccessToken,
        Value = accessToken
    },
    new AuthenticationToken
    {
        Name = OpenIdConnectParameterNames.RefreshToken,
        Value = refreshToken
    }
});

await httpContext.Authentication.SignInAsync("Automatic", info.Principal, info.Properties);
1 Answers
Related