src/Microsoft.IdentityModel.Tokens/TokenUtilities.cs
/// <summary>
/// Check whether the given exception type is recoverable by LKG.
/// </summary>
/// <param name="exception">The exception to check.</param>
/// <returns><c>true</c> if the exception is certain types of exceptions otherwise, <c>false</c>.</returns>
Check whether the given exception type is recoverable by LKG.
Check whether the given exception type is recoverable by LKG .
internal static bool IsRecoverableException(Exception exception)
        {
            return exception.GetType().Equals(typeof(SecurityTokenInvalidSignatureException))
                   || exception is SecurityTokenInvalidSigningKeyException
                   || exception is SecurityTokenInvalidIssuerException
                   || (exception as SecurityTokenUnableToValidateException)?.ValidationFailure != ValidationFailure.InvalidLifetime
                   || exception is SecurityTokenSignatureKeyNotFoundException;
        }
internal static bool IsRecoverableException ( Exception exception ) { return exception . GetType ( ) . Equals ( typeof ( SecurityTokenInvalidSignatureException ) ) || exception is SecurityTokenInvalidSigningKeyException || exception is SecurityTokenInvalidIssuerException || ( exception as SecurityTokenUnableToValidateException ) ? . ValidationFailure != ValidationFailure . InvalidLifetime || exception is SecurityTokenSignatureKeyNotFoundException ; }
Check whether the given exception type is recoverable by LKG.
Check whether the given exception type is recoverable by LKG .
// using 'GetType()' instead of 'is' as SecurityTokenUnableToValidException (and others) extend SecurityTokenInvalidSignatureException // we want to make sure that the clause for SecurityTokenUnableToValidateException is hit so that the ValidationFailure is checked // we should not try to revalidate with the LKG or request a refresh if the token has an invalid lifetime
None
exception
Exception
The exception to check.
The exception to check .