Owin CookieAuthentication OnValidateIdentity doesn't call regenerateIdentityCallback
<p>I'm trying to use OnValidateIdentity to check for security stamp changes.
But somehow  when validateInterval runs out I got logged out and the validator doesn't call regenerateIdentityCallback here is the auth code from startup.cs</p>

<pre><code>  app.CreatePerOwinContext(() =&gt;
        {
            var uow = DependencyResolver.Current.GetService&lt;IUnitOfWork&gt;();
            return uow.UsersRepository.UserManager;
        });
        app.UseCookieAuthentication(new Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions()
        {

            Provider = new CookieAuthenticationProvider()
            {
                OnApplyRedirect = context =&gt;
                {
                    if (!context.Request.Path.StartsWithSegments(new PathString("/api")))
                        context.Response.Redirect(context.RedirectUri);
                },
                OnValidateIdentity = context =&gt; SecurityStampValidator.OnValidateIdentity&lt;UserManager&lt;User&gt;, User, string&gt;(
                    validateInterval: TimeSpan.FromSeconds(15),
                    regenerateIdentityCallback: (mngr, usr) =&gt;
                    {
                        Debug.WriteLine("Regenerate identity");
                        var rolesStr = (mngr.GetRoles(usr.Id)).ToArray();
                        return AccountController.CreateClaims(usr, rolesStr);
                    },
                    getUserIdCallback: ci =&gt; 
                    {
                        return ci.GetUserId();
                    }).Invoke(context)
            },
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/"),
            CookieName = "Alisary",
            ExpireTimeSpan = TimeSpan.FromMinutes(20),
            SlidingExpiration = false,
        });
</code></pre>

<p>UserManger is In the DAL layer. The code:</p>

<pre><code>  public UserRepository(DatabaseContext context, IDataProtectionProvider dataProtection)
    {
        this.context = context;
        this.dataProtectionProvider = dataProtection;
        userManager = new UserManager&lt;User&gt;(
            new UserStore&lt;User&gt;(context));
        userManager.EmailService = new EmailSenderService();
        userManager.UserTokenProvider = new DataProtectorTokenProvider&lt;User&gt;(
            dataProtection.Create("protectionKey"))
        {
            TokenLifespan = TimeSpan.FromHours(24)
        };
        userManager.UserValidator = new UserValidator&lt;User&gt;(userManager)
        {
            AllowOnlyAlphanumericUserNames = false,
            RequireUniqueEmail = true
        };
        userManager.PasswordValidator = new PasswordValidator()
        {
            RequiredLength = 6,

        };


        roleManager = new RoleManager&lt;IdentityRole&gt;(
            new RoleStore&lt;IdentityRole&gt;(context));

    }
</code></pre>

<p>context is the database context.</p>