Called if InstanceID token is updated. This may occur if the security of
the previous token had been compromised. This call is initiated by the
InstanceID provider.
342330
@Override
    public void onTokenRefresh() {
        EasyGcm.Logger.d("Received token refresh broadcast");

        EasyGcm.removeRegistrationId(getApplicationContext());

        if (GcmUtils.checkCanAndShouldRegister(getApplicationContext())) {
            startService(GcmRegistrationService.createGcmRegistrationIntent(this));
        }
    }
918375
public void update(Connection conn, Token token) throws SQLException {
        run.update(conn
                   , "UPDATE tokens set expiration_ts=? WHERE id=?"
                   , token.getExpiration_ts()
                   , token.getId());
    }
1345133
private function updateClientAccessToken()
    {
        $user = $this->securityContext->getToken()->getUser();
        $this->client->updateAccessToken($user->getAccessToken());
    }
68598
def refresh_token(self, subid):
    ''''''
    from expfactory.database.models import Participant
    p = Participant.query.filter(Participant.id == subid).first()
    if p is not None:
        p.token = str(uuid.uuid4())
    self.session.commit()
    return p
1327812
private boolean releaseIdUpdated(ReleaseId oldReleaseId, ReleaseId newReleaseId) {
        if (oldReleaseId == null && newReleaseId == null) {
            return false;
        }
        if (oldReleaseId == null && newReleaseId != null) {
            return true;
        }
        // now both releaseIds are non-null, so it is safe to call equals()
        return !oldReleaseId.equals(newReleaseId);
    }
572233
def sendInstanceChange(self, view_no: int,
                           suspicion=Suspicions.PRIMARY_DEGRADED):
        

        # If not found any sent instance change messages in last
        # `ViewChangeWindowSize` seconds or the last sent instance change
        # message was sent long enough ago then instance change message can be
        # sent otherwise no.
        canSendInsChange, cooldown = self.insChngThrottler.acquire()
        if canSendInsChange:
            logger.info(
                "{}{} sending an instance change with view_no {}"
                " since {}".format(
                    VIEW_CHANGE_PREFIX,
                    self,
                    view_no,
                    suspicion.reason))
            logger.info("{}{} metrics for monitor: {}"
                        .format(MONITORING_PREFIX, self,
                                self.provider.pretty_metrics()))
            msg = self._create_instance_change_msg(view_no, suspicion.code)
            self.send(msg)
            # record instance change vote for self and try to change the view
            # if quorum is reached
            self._on_verified_instance_change_msg(msg, self.name)
        else:
            logger.info("{} cannot send instance change sooner then {} seconds".format(self, cooldown))
949334
public void bindInstanceToSecurityGroup(String instanceId, String securityGroupId) {
        this.bindInstanceToSecurityGroup(new BindSecurityGroupRequest()
                .withInstanceId(instanceId).withSecurityGroupId(securityGroupId));
    }
395435
def refresh(self):
        """"""
        if self.refresh_token is None:
            raise InvalidInvocation("refresh token not provided")
        self._request_token(
            grant_type="refresh_token", refresh_token=self.refresh_token
        )
94427
def _check_token(self):
        
        need_token = (self._token_info is None or
                      self.auth_handler.is_token_expired(self._token_info))
        if need_token:
            new_token = \
                self.auth_handler.refresh_access_token(
                    self._token_info['refresh_token'])
            # skip when refresh failed
            if new_token is None:
                return

            self._token_info = new_token
            self._auth_header = {"content-type": "application/json",
                                 "Authorization": "Bearer {}".format(
                                     self._token_info.get('access_token'))}
1302010
def is_instance_running(self, instance_id):
        
        instance = self._load_instance(instance_id)

        if instance.update() == "running":
            # If the instance is up&running, ensure it has an IP
            # address.
            if not instance.ip_address and self.request_floating_ip:
                log.debug("Public ip address has to be assigned through "
                          "elasticluster.")
                self._allocate_address(instance)
                instance.update()
            return True
        else:
            return False
254748
public void sessionIdChanged(String oldId, ISession session) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "sessionIdChanged", "application " + session.getContextId() + ":: from " + oldId + " to " + session.getId());
        }
        if (_sessionObservers == null || _sessionObservers.size() < 1) {
            return;
        }
        ISessionObserver sessionObserver = null;
        for (int i = 0; i < _sessionObservers.size(); i++) {
            sessionObserver = (ISessionObserver) _sessionObservers.get(i);
            sessionObserver.sessionIdChanged(oldId, session);
        }
    }
815698
function (instance) {
	if (instance.controller) {
		var i = 0, is_changed;

		for (; i < instance.change_detectors.length; ++i) {
			if (instance.change_detectors[i].is_changed()) {
				is_changed = true;
			}
		}

		if (instance.controller.on_digest) {
			instance.controller.on_digest();
		}
		if (is_changed && instance.controller.on_change) {
			instance.controller.on_change();
		}
	}
}
1196296
void updateProviderIfNeeded() {
        try {
            spiAndProviderUpdater.updateAndGetSpiAndProvider(null, spi, provider);
        } catch (Exception lastException) {
            ProviderException e = new ProviderException
                    ("Could not construct CipherSpi instance");
            if (lastException != null) {
                e.initCause(lastException);
            }
            throw e;
        }
    }
1100619
@Override
    protected boolean shouldEncryptTokenFor(final OidcRegisteredService svc) {
        if (AlgorithmIdentifiers.NONE.equalsIgnoreCase(svc.getIdTokenEncryptionAlg())) {
            LOGGER.warn("ID token encryption algorithm is set to none for [{}] and ID token will not be encrypted", svc.getServiceId());
            return false;
        }
        return svc.isEncryptIdToken() && StringUtils.isNotBlank(svc.getIdTokenEncryptionAlg()) && StringUtils.isNotBlank(svc.getIdTokenEncryptionEncoding());
    }
41846
def verify(self):
        
        # According to RFC 7519, the "exp" claim is OPTIONAL
        # (https://tools.ietf.org/html/rfc7519#section-4.1.4).  As a more
        # correct behavior for authorization tokens, we require an "exp"
        # claim.  We don't want any zombie tokens walking around.
        self.check_exp()

        # Ensure token id is present
        if api_settings.JTI_CLAIM not in self.payload:
            raise TokenError(_('Token has no id'))

        self.verify_token_type()
1366669
def invalidate_previous_tokens(sender, instance, **kwargs):
    
    active_tokens = None
    if isinstance(instance, CallbackToken):
        active_tokens = CallbackToken.objects.active().filter(user=instance.user).exclude(id=instance.id)

    # Invalidate tokens
    if active_tokens:
        for token in active_tokens:
            token.is_active = False
            token.save()
979288
public function refreshTokens()
    {
        if ($this->initialized === false) {
            $this->initialize();
        }

        $this->updateTokens($this->activeTokens);
    }