Search in sources :

Example 1 with ModelIllegalStateException

use of org.keycloak.models.ModelIllegalStateException in project keycloak by keycloak.

the class ResourceAdminManager method logoutAll.

// Methods for logout all
public GlobalRequestResult logoutAll(RealmModel realm) {
    realm.setNotBefore(Time.currentTime());
    GlobalRequestResult finalResult = new GlobalRequestResult();
    AtomicInteger counter = new AtomicInteger(0);
    realm.getClientsStream().forEach(c -> {
        try {
            counter.getAndIncrement();
            GlobalRequestResult currentResult = logoutClient(realm, c, realm.getNotBefore());
            finalResult.addAll(currentResult);
        } catch (ModelIllegalStateException ex) {
            // currently, GlobalRequestResult doesn't allow for information about clients that we were unable to retrieve.
            logger.warn("unable to retrieve client information for logout, skipping resource", ex);
        }
    });
    logger.debugv("logging out {0} resources ", counter);
    return finalResult;
}
Also used : GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ModelIllegalStateException(org.keycloak.models.ModelIllegalStateException)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ModelIllegalStateException (org.keycloak.models.ModelIllegalStateException)1 GlobalRequestResult (org.keycloak.representations.adapters.action.GlobalRequestResult)1