locked
What's UserManager.UserTokenProvider? RRS feed

  • Question

  • User2103511619 posted

    I can't find information on this property.

    What does it do? How can I utilize and customize it?

    Sunday, November 8, 2015 11:00 AM

Answers

  • User-986267747 posted

    Hi AxeID,

    : Is there some documentation available about the

    DataProtectorTokenProvider

    The protection provider in the following line is used as a token provider/generator.

    manager.UserTokenProvider = new DataProtectorTokenProvider<User>(dataProtectionProvider.Create("ASP.NET Identity"));

    It is responsible for generating an email confirmation token or a password reset token. If you do not set this line you won't be able to use this features (an appropriate exception will be thrown). An example can be found here.

    Its main purpose is to provide an implementation of the IDataProtector interface (through the Create method) which encrypts and decrypts data. An implementation for this interface in the framework is the DpapiDataProtectionProvider which should be used when the application is not hosted by ASP.NET. There are several other implementations on the web (for example one which uses the machine key for security purposes). class For more information about the DataProtectorTokenProvider have a look at the MSDN documentation.

    Besides, you could also refer to the following link to get more information.

    http://aspnet-docs-example.readthedocs.org/en/latest/autoapi/Microsoft/AspNet/Identity/DataProtectorTokenProvider/

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 9, 2015 8:25 PM

All replies

  • User603616845 posted

    Hi,

    UserManager.UserTokenProvider is used to Gets or sets a property used for generating reset password and confirmation tokens.

    See this msdn article for this.

    Hope this will help you.

    thanks

    Sunday, November 8, 2015 12:42 PM
  • User-986267747 posted

    Hi AxeID,

    What does it do? How can I utilize and customize it?

    As Mukesh_Kumar say, the property is used to Gets or sets a property used for generating reset password and confirmation tokens. If you'd like to get more information about use customer provider, you could refer to the following links.

    http://eliot-jones.com/2014/10/asp-identity-2-0-password-reset

    http://typecastexception.com/post/2014/04/20/ASPNET-MVC-and-Identity-20-Understanding-the-Basics.aspx

    I hope it's helpful to you.

    Best Regards,

    Klein zhang

    Monday, November 9, 2015 2:33 AM
  • User2103511619 posted

    Thank you for enlightening me on this. Now I apprehend what it's used for.

    Yet another question: Is there some documentation available about the

    DataProtectorTokenProvider

    class?

    MSDN is fairly sparse on this provider.

    What does it do? How does it work? What are it's parameters?

    Your help is appreciated.

    Monday, November 9, 2015 7:52 AM
  • User-986267747 posted

    Hi AxeID,

    : Is there some documentation available about the

    DataProtectorTokenProvider

    The protection provider in the following line is used as a token provider/generator.

    manager.UserTokenProvider = new DataProtectorTokenProvider<User>(dataProtectionProvider.Create("ASP.NET Identity"));

    It is responsible for generating an email confirmation token or a password reset token. If you do not set this line you won't be able to use this features (an appropriate exception will be thrown). An example can be found here.

    Its main purpose is to provide an implementation of the IDataProtector interface (through the Create method) which encrypts and decrypts data. An implementation for this interface in the framework is the DpapiDataProtectionProvider which should be used when the application is not hosted by ASP.NET. There are several other implementations on the web (for example one which uses the machine key for security purposes). class For more information about the DataProtectorTokenProvider have a look at the MSDN documentation.

    Besides, you could also refer to the following link to get more information.

    http://aspnet-docs-example.readthedocs.org/en/latest/autoapi/Microsoft/AspNet/Identity/DataProtectorTokenProvider/

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 9, 2015 8:25 PM
  • User2103511619 posted

    Great answer! Very enlightening.

    Thank you!

    Wednesday, November 11, 2015 5:42 AM