public override string ToString()
        {
            var validUntil   = Created.AddSeconds(ExpiresInSeconds);
            var strIsExpired = IsExpired ? "(expired)" : $"(valid until {validUntil})";

            return(IsValid ? $"{AccessToken} {strIsExpired}" : $"no valid access token {strIsExpired}");
        }
Beispiel #2
0
        public override bool IsValid()
        {
            if (string.IsNullOrWhiteSpace(Token) || string.IsNullOrWhiteSpace(RefreshToken))
            {
                return(false);
            }
            var expireTime = Created.AddSeconds(ExpiresIn);

            return(expireTime > DateTime.UtcNow);
        }
Beispiel #3
0
        public override bool IsValid()
        {
            if (string.IsNullOrWhiteSpace(Token))
            {
                return(false);
            }
            // This allows you to specify -1 for never expires
            if (ExpiresIn <= 0)
            {
                return(true);
            }
            if (string.IsNullOrWhiteSpace(RefreshToken))
            {
                return(false);
            }
            var expireTime = Created.AddSeconds(ExpiresIn);

            return(expireTime > DateTime.UtcNow);
        }
Beispiel #4
0
        public bool IsValid()
        {
            if (string.IsNullOrWhiteSpace(Token))
            {
                return(false);
            }
            // This allows you to specify -1 for never expires
            if (ExpiresIn <= 0)
            {
                return(true);
            }
            if (string.IsNullOrWhiteSpace(RefreshToken))
            {
                return(false);
            }
            // for simplicity sake, just expire it a 5 min early
            var expireTime = Created.AddSeconds(ExpiresIn - 300);

            return(expireTime > DateTime.UtcNow);
        }