Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

ASP.NET Identity, Confirming emails "purpose parameter", passing wrong value

$
0
0

I have created my own ASP.NET UserStore and TokenStore and having issues with email confirmation. In the token store there is a method called validate async as seen below.

        public Task<bool> ValidateAsync(string purpose, string token, UserManager<Users, int> manager, Users user)
        {
            if(purpose==ResetPasswordTokenPurpose)
            {
                return Task.FromResult<bool>(user.PasswordResetToken.ToString() == token);
            }
            else if(purpose == ConfirmEmailTokenPurpose)
            {
                return Task.FromResult<bool>(user.EmailConfirmationToken.ToString() == token);
            }

            return Task.FromResult(false);
        }

The problem I am having is that the "purpose" parameter passed is called "Confirm" and not EmailConfirmation as seen in the github source code:

https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNetCore.Identity/UserManager.cs

In our UserManager when I call ConfirmEmailAsync I only pass userid and token not purpose, I am guessing this is done behind the scenes. Does this mean I have override this method in my own UserManager?


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>