Provide access to flag indicating if token has expired.
19988
def token_expired(self):
        """"""
        if self._token_timer is None:
            return True
        return timeutil.is_newer_than(self._token_timer, timeutil.ONE_HOUR)
673073
def _token_valid(self):
        
        if not self._cache_token:
            return False
        now = time.time()
        if now - self._token.acquired_time > self._token_timeout:
            logger.debug('token needs to be reset')
            return False
        return True
860786
def _selftoken_expired():
    '''
    
    '''
    try:
        verify = __opts__['vault'].get('verify', None)
        url = '{0}/v1/auth/token/lookup-self'.format(__opts__['vault']['url'])
        if 'token' not in __opts__['vault']['auth']:
            return True
        headers = {'X-Vault-Token': __opts__['vault']['auth']['token']}
        response = requests.get(url, headers=headers, verify=verify)
        if response.status_code != 200:
            return True
        return False
    except Exception as e:
        raise salt.exceptions.CommandExecutionError(
            'Error while looking up self token : {0}'.format(six.text_type(e))
            )
1275198
public function isExpired()
    {
        if (null === $this->created || 0 === $this->lifetime) {
            throw new \LogicException(
                'Cannot define if token is expired, created datetime or/and lifetime are missing.'
            );
        }

        return time() > strtotime($this->created) + $this->lifetime;
    }
124639
boolean expiringSoon(TokenInfo info) {
        // TODO(jasonhall): Consider varying the definition of "soon" based on the
        // original expires_in value (e.g., "soon" = 1/10th of the total time before
        // it's expired).
        return Double.valueOf(info.getExpires()) < (clock.now() + TEN_MINUTES);
    }
604464
def is_expired_token(self, client):
        
        if 'expires' not in client:
            return True

        expires = dateutil.parser.parse(client['expires'])
        if expires < datetime.datetime.now():
            return True

        return False
1179139
def get_expired(self):
        
        max_age = timezone.now() - timedelta(seconds=app_settings.ESI_TOKEN_VALID_DURATION)
        return self.filter(created__lte=max_age)
889127
def confirm_email(token):
    """"""

    expired, invalid, user = confirm_email_token_status(token)

    if not user or invalid:
        invalid = True
        do_flash(*get_message('INVALID_CONFIRMATION_TOKEN'))

    already_confirmed = user is not None and user.confirmed_at is not None

    if expired and not already_confirmed:
        send_confirmation_instructions(user)
        do_flash(*get_message('CONFIRMATION_EXPIRED', email=user.email,
                              within=_security.confirm_email_within))
    if invalid or (expired and not already_confirmed):
        return redirect(get_url(_security.confirm_error_view) or
                        url_for('send_confirmation'))

    if user != current_user:
        logout_user()

    if confirm_user(user):
        after_this_request(_commit)
        msg = 'EMAIL_CONFIRMED'
    else:
        msg = 'ALREADY_CONFIRMED'

    do_flash(*get_message(msg))

    return redirect(get_url(_security.post_confirm_view) or
                    get_url(_security.login_url))
362695
@JsonIgnore
    protected boolean isAccessTokenExpired(final TicketState ticketState) {
        val currentSystemTime = ZonedDateTime.now(ZoneOffset.UTC);
        val creationTime = ticketState.getCreationTime();

        var expirationTime = creationTime.plus(this.maxTimeToLiveInSeconds, ChronoUnit.SECONDS);
        if (currentSystemTime.isAfter(expirationTime)) {
            LOGGER.debug("Access token is expired because the time since creation is greater than maxTimeToLiveInSeconds");
            return true;
        }

        val expirationTimeToKill = ticketState.getLastTimeUsed().plus(this.timeToKillInSeconds, ChronoUnit.SECONDS);
        if (currentSystemTime.isAfter(expirationTimeToKill)) {
            LOGGER.debug("Access token is expired because the time since last use is greater than timeToKillInSeconds");
            return true;
        }
        return false;
    }
186054
def check_password_expired(user):
    
    if not settings.ACCOUNT_PASSWORD_USE_HISTORY:
        return False

    if hasattr(user, "password_expiry"):
        # user-specific value
        expiry = user.password_expiry.expiry
    else:
        # use global value
        expiry = settings.ACCOUNT_PASSWORD_EXPIRY

    if expiry == 0:  # zero indicates no expiration
        return False

    try:
        # get latest password info
        latest = user.password_history.latest("timestamp")
    except PasswordHistory.DoesNotExist:
        return False

    now = datetime.datetime.now(tz=pytz.UTC)
    expiration = latest.timestamp + datetime.timedelta(seconds=expiry)

    if expiration < now:
        return True
    else:
        return False
544798
def validate_exp(max_clock_skew = 0)
      max_clock_skew ||= 0

      exp = time_claim("exp")
      if exp && exp <= (Time.now - max_clock_skew)
        raise Sandal::ExpiredTokenError, "The token has expired." 
      end
    end
1035670
private function tokenExpired()
    {
        $tokenExpirationTime = $this->requestTimestamp
            + $this->data[static::RESPONSE_KEY_ACCESS_TOKEN_TTL]
            - static::TTL_CORRECTION_TIME_SEC;

        return $this->tokenExists() && time() > $tokenExpirationTime;
    }
1153494
def expired?(request, method)
      if (expires_at = request.expires_at) && expires_at > 0 && (now = Time.now.to_i) >= expires_at
        @reject_stats.update("expired (#{method})")
        Log.info("REJECT EXPIRED <#{request.token}> from #{request.from} TTL #{RightSupport::Stats.elapsed(now - expires_at)} ago")
        # For agents that do not know about non-delivery, use error result
        if can_handle_non_delivery_result?(request.recv_version)
          OperationResult.non_delivery(OperationResult::TTL_EXPIRATION)
        else
          OperationResult.error("Could not deliver request (#{OperationResult::TTL_EXPIRATION})")
        end
      end
    end
1280171
def _is_expired(self, key):
        """"""
        if not hasattr(self, '_index'):
            return False  # haven't initalized yet, so don't bother
        try:
            timeout = self._index[key]
        except KeyError:
            if self.timeout:
                self._index[key] = int(time() + self.timeout)
            else:
                self._index[key] = None
            return False
        if timeout is None or timeout >= time():
            return False
        del self[key]  # key expired, so delete it from container
        return True
713547
@Transactional(readOnly = true)
    public void validateToken(E token) throws Exception {

        if (token == null) {
            throw new Exception("The provided token is null.");
        }

        DateTime expirationDate = (DateTime) token.getExpirationDate();

        String tokenValue = token.getToken();

        // check if the token expire date is valid
        if (expirationDate.isBeforeNow()) {
            throw new Exception("The token '" + tokenValue + "' expired on '"
                + expirationDate + "'");
        }

    }
819346
def check_exp(self, claim='exp', current_time=None):
        
        if current_time is None:
            current_time = self.current_time

        try:
            claim_value = self.payload[claim]
        except KeyError:
            raise TokenError(format_lazy(_("Token has no '{}' claim"), claim))

        claim_time = datetime_from_epoch(claim_value)
        if claim_time <= current_time:
            raise TokenError(format_lazy(_("Token '{}' claim has expired"), claim))
282348
public Boolean isExpired(String token) {
        final Date expiration = getExpirationDateFromToken(token);
        return expiration.before(new Date());
    }