Search in sources :

Example 11 with GlobalRequestResult

use of org.keycloak.representations.adapters.action.GlobalRequestResult in project keycloak by keycloak.

the class ResourceAdminManager method pushRealmRevocationPolicy.

public GlobalRequestResult pushRealmRevocationPolicy(RealmModel realm) {
    GlobalRequestResult finalResult = new GlobalRequestResult();
    realm.getClientsStream().forEach(c -> {
        GlobalRequestResult currentResult = pushRevocationPolicy(realm, c, realm.getNotBefore());
        finalResult.addAll(currentResult);
    });
    return finalResult;
}
Also used : GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult)

Example 12 with GlobalRequestResult

use of org.keycloak.representations.adapters.action.GlobalRequestResult in project keycloak by keycloak.

the class ResourceAdminManager method testNodesAvailability.

public GlobalRequestResult testNodesAvailability(RealmModel realm, ClientModel client) {
    List<String> mgmtUrls = getAllManagementUrls(client);
    if (mgmtUrls.isEmpty()) {
        logger.debug("No management URL or no registered cluster nodes for the application " + client.getClientId());
        return new GlobalRequestResult();
    }
    if (logger.isDebugEnabled())
        logger.debug("Sending test nodes availability: " + mgmtUrls);
    // Propagate this to all hosts
    GlobalRequestResult result = new GlobalRequestResult();
    for (String mgmtUrl : mgmtUrls) {
        if (sendTestNodeAvailabilityRequest(realm, client, mgmtUrl)) {
            result.addSuccessRequest(mgmtUrl);
        } else {
            result.addFailedRequest(mgmtUrl);
        }
    }
    return result;
}
Also used : GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult)

Example 13 with GlobalRequestResult

use of org.keycloak.representations.adapters.action.GlobalRequestResult in project keycloak by keycloak.

the class RealmTest method pushNotBeforeWithSamlApp.

@Test
public void pushNotBeforeWithSamlApp() {
    setupTestAppAndUser();
    setupTestSamlApp();
    int time = Time.currentTime() - 60;
    RealmRepresentation rep = realm.toRepresentation();
    rep.setNotBefore(time);
    realm.update(rep);
    assertAdminEvents.assertEvent(realmId, OperationType.UPDATE, Matchers.nullValue(String.class), rep, ResourceType.REALM);
    GlobalRequestResult globalRequestResult = realm.pushRevocation();
    assertAdminEvents.assertEvent(realmId, OperationType.ACTION, "push-revocation", globalRequestResult, ResourceType.REALM);
    assertThat(globalRequestResult.getSuccessRequests(), containsInAnyOrder(oauth.AUTH_SERVER_ROOT + "/realms/master/app/admin"));
    assertThat(globalRequestResult.getFailedRequests(), containsInAnyOrder(oauth.AUTH_SERVER_ROOT + "/realms/master/saml-app/saml"));
    PushNotBeforeAction adminPushNotBefore = testingClient.testApp().getAdminPushNotBefore();
    assertEquals(time, adminPushNotBefore.getNotBefore());
}
Also used : GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult) RealmRepresentation(org.keycloak.representations.idm.RealmRepresentation) PushNotBeforeAction(org.keycloak.representations.adapters.action.PushNotBeforeAction) AbstractAdminTest(org.keycloak.testsuite.admin.AbstractAdminTest) Test(org.junit.Test)

Aggregations

GlobalRequestResult (org.keycloak.representations.adapters.action.GlobalRequestResult)13 Test (org.junit.Test)5 Path (javax.ws.rs.Path)3 RealmRepresentation (org.keycloak.representations.idm.RealmRepresentation)3 ResourceAdminManager (org.keycloak.services.managers.ResourceAdminManager)3 AbstractAdminTest (org.keycloak.testsuite.admin.AbstractAdminTest)3 POST (javax.ws.rs.POST)2 Produces (javax.ws.rs.Produces)2 PushNotBeforeAction (org.keycloak.representations.adapters.action.PushNotBeforeAction)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 GET (javax.ws.rs.GET)1 Response (javax.ws.rs.core.Response)1 NoCache (org.jboss.resteasy.annotations.cache.NoCache)1 ModelIllegalStateException (org.keycloak.models.ModelIllegalStateException)1 TestAvailabilityAction (org.keycloak.representations.adapters.action.TestAvailabilityAction)1 ClientRepresentation (org.keycloak.representations.idm.ClientRepresentation)1 AbstractServletsAdapterTest (org.keycloak.testsuite.adapter.AbstractServletsAdapterTest)1 AccessTokenResponse (org.keycloak.testsuite.util.OAuthClient.AccessTokenResponse)1