public void checkInterval()

in src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/jwt/DateValidator.java [52:82]


    public void checkInterval(final JsonObject payload) {
        long now = -1;

        final JsonNumber exp = payload.getJsonNumber(Claims.exp.name());
        if (exp == null) {
            if (expirationMandatory) {
                throw new JwtException("No exp in the JWT", HttpURLConnection.HTTP_UNAUTHORIZED);
            }
        } else {
            final long expValue = exp.longValue();
            now = now();
            if (expValue < now - tolerance) {
                throw new JwtException("Token expired", HttpURLConnection.HTTP_UNAUTHORIZED);
            }
        }

        final JsonNumber iat = payload.getJsonNumber(Claims.iat.name());
        if (iat == null) {
            if (issuedAtTimeMandatory) {
                throw new JwtException("No iat in the JWT", HttpURLConnection.HTTP_UNAUTHORIZED);
            }
        } else {
            final long iatValue = iat.longValue();
            if (now < 0) {
                now = now();
            }
            if (iatValue > now + tolerance) {
                throw new JwtException("Token issued after current time", HttpURLConnection.HTTP_UNAUTHORIZED);
            }
        }
    }