locked
Implementing IUserPasswordStore for the default ASP.NET Identity Provider RRS feed

  • Question

  • User122146289 posted

    Hello,

    Is there some way that i could implement the IUserPasswordStore interface and extend the capabilities of the default Identity provider?

    I know that a complete custom implementation can resolve the problem, but I am not sure if I will ever get approval to do it, or use a third-party provider.

    Thanks for your help!

    Friday, April 4, 2014 12:33 AM

Answers

  • User1779161005 posted

    The async and await keywords, perhaps?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 4, 2014 9:09 PM

All replies

  • User1779161005 posted

    Sure, but it's somewhat a pain. What problem are you trying to overcome?

    Friday, April 4, 2014 9:22 AM
  • User122146289 posted

    Hi Brock,

    I am trying to implement PasswordExpiry validation

    Example: When user changes passwords, a password used in the last 90 days cannot be reused

    Password Lock Out policy - User is locked out after 3 failed login attempts

    Thanks

    Friday, April 4, 2014 11:48 AM
  • User1779161005 posted

    The lockout is built-in (sort of) in v2. But if you're still on v1, then yea, you'll have to do it yourself.

    Here's some sample code that shows what this might look like:

    https://github.com/brockallen/BrockAllen.IdentityReboot/tree/v1

    Make sure you look at the v1 branch.

    Friday, April 4, 2014 11:55 AM
  • User122146289 posted

    Thanks Brock! I will go through this code in detail. My Friday was gone in finding solution to a related problem, and I will present it here .
    The issue is related to implementing the FindASync method of IUserLoginStore.

    Here is a code snippet. I may be doing this completely wrong, or I'm not seeing the obvious. Sorry about the bold texting, but it looks like this editor does not have any coloring options.


    Task<ApplicationUser> IUserLoginStore<ApplicationUser>.FindASync(UserLoginInfo login)

    {

         var user =userStore.FindAsync(login);  //userStore is my cusom implementation of UserStore

    // This method returns successfully confirming that a Google Login is found in the AppUserLogin table and the return type is Task<IdentityUser>

    // However, the return type of FindASync is Task<ApplicationUser>. As a result, my return type fails!

    //ApplicationUser implements the IdentityUser Interface

    //What am I missing?

    }

    Friday, April 4, 2014 8:45 PM
  • User1779161005 posted

    The async and await keywords, perhaps?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 4, 2014 9:09 PM
  • User122146289 posted

    Yep! that was the problem! Smile

    I failed to notice that the FindAsync method call was awaitable in the controller Login action.

    Thanks much!

    Now on to the Lockout research!...

    Saturday, April 5, 2014 12:47 PM
  • User122146289 posted

    Brock, I have to add this to our application somewhere down the line. As of now, our options are limited to registering users by converting the registration functions to an Admin management function. Therefore, the password reset functionality is not really at the top of anyones list right now (i know! but business realities trump technical enthusiasm!)

    Also, an internal preview of the prototype application lead to an overwhelming vote to push for authentication against active directory.

    I have since integrated active directory authentication with the Identity system, and users get registered with an External Login.

    Thanks for your help with this.

    Friday, April 18, 2014 11:29 AM