use of org.keycloak.testsuite.arquillian.annotation.EnableFeature in project keycloak by keycloak.
the class PartialImportTest method testAddClientsOverwriteWithServiceAccountsAndAuthorization.
@EnableFeature(value = UPLOAD_SCRIPTS, skipRestart = true)
@Test
public void testAddClientsOverwriteWithServiceAccountsAndAuthorization() throws IOException {
addClients(true);
setOverwrite();
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES * 2, results.getAdded());
results = doImport();
assertEquals(NUM_ENTITIES * 2, results.getOverwritten());
}
use of org.keycloak.testsuite.arquillian.annotation.EnableFeature in project keycloak by keycloak.
the class PartialImportTest method testAddClientsOverwriteServiceAccountsWithNoServiceAccounts.
@EnableFeature(value = UPLOAD_SCRIPTS, skipRestart = true)
@Test
public void testAddClientsOverwriteServiceAccountsWithNoServiceAccounts() throws IOException {
addClients(true);
setOverwrite();
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES * 2, results.getAdded());
// check the service accounts are there
for (int i = 0; i < NUM_ENTITIES; i++) {
List<UserRepresentation> l = testRealmResource().users().search(ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX + CLIENT_PREFIX + i);
Assert.assertEquals(1, l.size());
}
// re-import without service accounts enabled
piRep = new PartialImportRepresentation();
addClients(false);
setOverwrite();
results = doImport();
assertEquals(NUM_ENTITIES, results.getOverwritten());
// check the service accounts have been removed
for (int i = 0; i < NUM_ENTITIES; i++) {
List<UserRepresentation> l = testRealmResource().users().search(ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX + CLIENT_PREFIX + i);
Assert.assertEquals(0, l.size());
}
}
use of org.keycloak.testsuite.arquillian.annotation.EnableFeature in project keycloak by keycloak.
the class UndeployedScriptMapperNotAvailableTest method testMapperNotRecognizedWhenDisabled.
@Test
@EnableFeature(value = SCRIPTS, skipRestart = true, executeAsLast = false)
public void testMapperNotRecognizedWhenDisabled() throws Exception {
ClientResource app = findClientResourceByClientId(adminClient.realm("test"), "test-app");
{
ProtocolMapperRepresentation mapper = createScriptMapper("test-script-mapper1", "computed-via-script", "computed-via-script", "String", true, true, "'hello_' + user.username", false);
mapper.setProtocolMapper("script-mapper-a.js");
app.getProtocolMappers().createMapper(mapper).close();
}
deployer.undeploy(SCRIPT_DEPLOYMENT_NAME);
reconnectAdminClient();
ClientResource cl = findClientResourceByClientId(adminClient.realm("test"), "test-app");
assertTrue(cl.getProtocolMappers().getMappers().isEmpty());
assertTrue(cl.getProtocolMappers().getMappersPerProtocol(cl.toRepresentation().getProtocol()).isEmpty());
}
use of org.keycloak.testsuite.arquillian.annotation.EnableFeature in project keycloak by keycloak.
the class FineGrainAdminUnitTest method testWithTokenExchange.
/**
* KEYCLOAK-7406
*
* @throws Exception
*/
@Test
@UncaughtServerErrorExpected
@AuthServerContainerExclude(AuthServer.REMOTE)
@EnableFeature(value = Profile.Feature.TOKEN_EXCHANGE, skipRestart = true)
public void testWithTokenExchange() throws Exception {
String exchanged = checkTokenExchange(true);
Assert.assertNotNull(exchanged);
try (Keycloak client = Keycloak.getInstance(getAuthServerContextRoot() + "/auth", AuthRealm.MASTER, Constants.ADMIN_CLI_CLIENT_ID, exchanged, TLSUtils.initializeTLS())) {
Assert.assertNotNull(client.realm("master").roles().get("offline_access"));
}
}
Aggregations