public void refresh(final UserIdentity userIdentity) {
        Objects.requireNonNull(userIdentity, "Null userIdentity");
        if (userIdentity instanceof final HasRefreshable hasRefreshable) {

            // This will try and refresh/recreate the token just before it expires
            // so that there is no delay for users of the token. They can explicitly call
            // refresh after checking AbstractTokenUserIdentity.hasTokenExpired() if they don't trust
            // the refresh queue, but it should always return false.
            final Refreshable refreshable = hasRefreshable.getRefreshable();
            final boolean didRefresh = refreshable.refreshIfRequired(
                    RefreshMode.JUST_IN_TIME, refreshManager::addOrUpdate);

            if (LOGGER.isTraceEnabled()) {
                if (!didRefresh) {
                    LOGGER.trace("Refresh not done for userIdentity: {}, updatableToken: {}",
                            userIdentity, refreshable);
                }
            }
        }
    }
Refresh the user identity including any tokens associated with that user.

@param userIdentity
stroom-security/stroom-security-common-impl/src/main/java/stroom/security/common/impl/AbstractUserIdentityFactory.java