How to Add Claim to ApplicationUser in custom SignInManager
<p>Converting my MVC app to utilize AspNet Identity. I have created an ApoplicationSignInManager class that extends SignInManager</p>

<p>I am overriding CreateIdentityAsyc and I want to add custom claims here without persisting to db so that the values are available for logged in users.</p>

<pre><code>public class ApplicationSignInManager : SignInManager&lt;ApplicationUser, string&gt;
{
    private readonly IUserService userService;

    public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager, IUserService userService)
        : base(userManager, authenticationManager)
    {
        this.userService = userService;
    }

    public override Task&lt;ClaimsIdentity&gt; CreateUserIdentityAsync(ApplicationUser user)
    {
        var myUser = userService.GetUser(user.Id);

        var userIdentity = user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);

        userIdentity.Result.AddClaim(new Claim("MyCustomID", myUser.CutomID.ToString()));

        return userIdentity;
    }
}
</code></pre>

<p>My problem is that the app hangs when executing the AddClaims line. I am guessing this has something to do with a deadlock from async task but I can't figure out how to fix this.</p>

<p>Please give me some guidance.</p>