Generate a Short EmailConfirmationToken

时间:2015-10-06 09:01:29

标签: c# asp.net asp.net-identity

I'm trying to implement a registration prozess for my webapp. The problem is that the generated "userManager.GenerateEmailConfirmationTokenAsync(user.Id);" code is to long. Is there any possibility for generating a short one like this: "qwert12345asdfg6"

My UserTokenProvider is implemented like this:

        var dataProtectionProvider = new DpapiDataProtectionProvider("IdentityServer3");

        if (dataProtectionProvider != null)
        {
            UserTokenProvider = new DataProtectorTokenProvider<User>(dataProtectionProvider.Create("ASP.NET Identity")) 
            {
                TokenLifespan = TimeSpan.FromHours(3)
            };
        }

Do you have an idea what do I need to do?

1 个答案:

答案 0 :(得分:0)

ASP.NET Identity使用UserTokenProvider的{​​{1}}生成并验证令牌。

您可以实现自己的UserManager或扩展默认值,而不是设置为UserManager.UserTokenProvider。

https://stackoverflow.com/a/24994413/659695