如何在ASP.Net Identity 2中重写RefreshSign

时间:2015-08-03 19:05:18

标签: asp.net-mvc asp.net-identity asp.net-identity-2 asp.net-identity-3

有没有办法从带有ASP.NET Identity 2的ASP.NET Identity 3 SignInManager重写此方法?

https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNet.Identity/SignInManager.cs#L110

    /// <summary>
    /// Regenerates the user's application cookie, whilst preserving the existing
    /// AuthenticationProperties like rememberMe, as an asynchronous operation.
    /// </summary>
    /// <param name="user">The user whose sign-in cookie should be refreshed.</param>
    /// <returns>The task object representing the asynchronous operation.</returns>
    public virtual async Task RefreshSignInAsync(TUser user)
    {
        var auth = new AuthenticateContext(IdentityOptions.ApplicationCookieAuthenticationScheme);
        await Context.Authentication.AuthenticateAsync(auth);
        var authenticationMethod = auth.Principal?.FindFirstValue(ClaimTypes.AuthenticationMethod);
        await SignInAsync(user, new AuthenticationProperties(auth.Properties), authenticationMethod);
    }

0 个答案:

没有答案