IdentityServer/IdentityServer3.AspNetIdentity

UserService not update userinfo when database changed

Closed this issue · 4 comments

I have 2 system:

  1. IdentityServer3 using AspNetIdentity
  2. IdentityManager

I login IdentityManager and change password => view on database it have changed. But login by IdentityServer3 then password is old and not change with new password.

I don't understand IdentityServer3 with AspNetIdentity using cache how?
In class AspNetIdentityUserService debug to method AuthenticateLocalAsync call FindUserAsync(username) is running to database, But I view result of method FindUserAsync(username) then UserInfo <> UserInfo on Database?

Can you have me?

Make sure you are not caching your DbContext on the IdSvr side.

I using:

public static void ConfigureUserService(this IdentityServerServiceFactory factory, ApplicationDbContext dbContext)
{
factory.UserService = new Registration<IUserService, UserService>();
//factory.ClaimsProvider = new Registration<IClaimsProvider, AscendClaimsProvider>();
factory.Register(new Registration<ApplicationUserManager>());
factory.Register(new Registration<ApplicationDbContext>(dbContext));
}

Not sure then -- you'll have to debug some more.

I fixed by after solution:
public static void ConfigureUserService(this IdentityServerServiceFactory factory)
{
factory.UserService = new Registration<IUserService, UserService>();
//factory.ClaimsProvider = new Registration<IClaimsProvider, AscendClaimsProvider>();
factory.Register(new Registration<ApplicationUserManager>());

        //factory.Register(new Registration<ApplicationDbContext>(new ApplicationDbContext()));
        //DBContext not Caching, Fix bug DB Changed => IdSrv not change
        factory.Register(new Registration<ApplicationDbContext>(resolver => new ApplicationDbContext()));
    }

Thank for support