title: How to implement a custom method as User.Identity.GetLastUserToken() to get last assigned token in two-factor authentication?
body: <p>I implement two-factor authetentication as seen in <a href="http://blogs.msdn.com/b/webdev/archive/2014/02/18/adding-two-factor-authentication-to-an-application-using-asp-net-identity.aspx" rel="nofollow">http://blogs.msdn.com/b/webdev/archive/2014/02/18/adding-two-factor-authentication-to-an-application-using-asp-net-identity.aspx</a> but I would like show to user in templete view a <code>TokenViewModel object</code> with two property, <code>TokenDate</code> and <code>TokenString</code> retrived by <code>@User.Identity.GetLastUserToken().TokenDate</code> and <code>@User.Identity.GetLastUserToken().TokenString</code> at View.</p>
  
  <p>I just do it.</p>
  
  <pre><code>public static class ApplicationIdentityExtensions
  {
      public static string FindFirstValue(this ClaimsIdentity identity, string claimType)
      {
          return null;
      }
  
      public static TokenViewModel GetLastUserToken(this IIdentity identity)
      {
          return new TokenViewModel(){ TokenDate = DateTime.Now, TokenString= "Token from Mock" };
      }
  
  }
  </code></pre>
  
  <p>As you can see, <code>EmailTokenProvider</code> in <code>manager.RegisterTwoFactorProvider("EmailCode", new EmailTokenProvider&lt;ApplicationUser&gt;()</code> line was inherit by <code>IUserTokenProvider&lt;TKey, TValue&gt;</code> and them I implement by my self at my project.</p>
  
  <p>This inherit must to implement those method:</p>
  
  <pre><code>    public Task&lt;bool&gt; ValidateAsync(string purpose, string token, UserManager&lt;Usuario, int&gt; manager, Usuario user)
      {
          //TODO: I guess, must to validate user custom token here using my _respositoryToken.
  </code></pre>
  
  <p><strong>I would like set token var in User.Identity scope but I don't know exactly.</strong></p>
  
  <pre><code>        return Task.FromResult(true);
      }
  </code></pre>
  
  <p><strong>How can I do that?</strong></p>