JwtHelper

Ecng.Net

Minimal read-only helpers over a JWT — just enough to know when an access token is about to expire so a caller can refresh it before (re)authenticating. The signature is NOT verified here (that is the issuer's / server's job).

Methoden

GetExpiry
public static DateTime? GetExpiry(string token)
result = JwtHelper.GetExpiry(token)

The token's expiry (UTC) from the exp claim, or if it cannot be read.

IsExpiredOrExpiring
public static bool IsExpiredOrExpiring(string token, TimeSpan skew)
result = JwtHelper.IsExpiredOrExpiring(token, skew)

Whether the token is already expired or will expire within . Returns when the expiry cannot be determined, so a readable token is never refreshed needlessly and an unreadable one is left for the server to reject.