protected virtual void CleanupExpiredTokens()
 {
     using (new SecurityDisabler())
     {
         var challenges = RootItem.GetChildren();
         foreach (Item challenge in challenges)
         {
             // if the value in the field is not a valid long (ticks) value, or the value is valid but too old, we kill it
             if (!long.TryParse(challenge["Expires"], out var expiresTicks) || expiresTicks < DateTime.UtcNow.Ticks)
             {
                 // challenge name starts with 'AUTH'
                 _challengeStoreLogger?.ChallengeExpired(challenge.Name.Substring(4));
                 challenge.Delete();
             }
         }
     }
 }
示例#2
0
        protected virtual void CleanupExpiredTokens()
        {
            using (new SecurityDisabler())
            {
                var challenges = RootItem.GetChildren();
                foreach (Item challenge in challenges)
                {
                    long expiresTicks;

                    if (!long.TryParse(challenge["Expires"], out expiresTicks))
                    {
                        challenge.Delete();
                    }
                    if (expiresTicks < DateTime.UtcNow.Ticks)
                    {
                        challenge.Delete();
                    }
                }
            }
        }