Java Code Examples for org.keycloak.representations.idm.ClientRepresentation#setName()
The following examples show how to use
org.keycloak.representations.idm.ClientRepresentation#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeycloakModelUtils.java From keycloak with Apache License 2.0 | 6 votes |
public static ClientRepresentation createClient(RealmRepresentation realm, String name) { ClientRepresentation app = new ClientRepresentation(); app.setName(name); app.setClientId(name); List<ClientRepresentation> clients = realm.getClients(); if (clients != null) { clients.add(app); } else { realm.setClients(Arrays.asList(app)); } app.setClientAuthenticatorType(getDefaultClientAuthenticatorType()); generateSecret(app); app.setFullScopeAllowed(true); return app; }
Example 2
Source File: PartialImportTest.java From keycloak with Apache License 2.0 | 6 votes |
@Before public void createClientWithServiceAccount() { ClientRepresentation client = new ClientRepresentation(); client.setClientId(CLIENT_SERVICE_ACCOUNT); client.setName(CLIENT_SERVICE_ACCOUNT); client.setRootUrl("http://localhost/foo"); client.setProtocol("openid-connect"); client.setPublicClient(false); client.setSecret("secret"); client.setServiceAccountsEnabled(true); try (Response resp = testRealmResource().clients().create(client)) { String id = ApiUtil.getCreatedId(resp); UserRepresentation serviceAccountUser = testRealmResource().clients().get(id).getServiceAccountUser(); assertNotNull(serviceAccountUser); } }
Example 3
Source File: KcOidcBrokerConfiguration.java From keycloak with Apache License 2.0 | 6 votes |
@Override public List<ClientRepresentation> createConsumerClients() { ClientRepresentation client = new ClientRepresentation(); client.setId("broker-app"); client.setClientId("broker-app"); client.setName("broker-app"); client.setSecret("broker-app-secret"); client.setEnabled(true); client.setDirectAccessGrantsEnabled(true); client.setRedirectUris(Collections.singletonList(getConsumerRoot() + "/auth/*")); client.setBaseUrl(getConsumerRoot() + "/auth/realms/" + REALM_CONS_NAME + "/app"); return Collections.singletonList(client); }
Example 4
Source File: ConsentsTest.java From keycloak with Apache License 2.0 | 6 votes |
protected List<ClientRepresentation> createProviderClients() { ClientRepresentation client = new ClientRepresentation(); client.setId(CLIENT_ID); client.setName(CLIENT_ID); client.setSecret(CLIENT_SECRET); client.setEnabled(true); client.setConsentRequired(true); client.setRedirectUris(Collections.singletonList(getAuthRoot() + "/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint/*")); client.setAdminUrl(getAuthRoot() + "/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint"); return Collections.singletonList(client); }
Example 5
Source File: ClientScopeTest.java From keycloak with Apache License 2.0 | 5 votes |
@Test public void testRemoveClientScopeInUse() { // Add client scope ClientScopeRepresentation scopeRep = new ClientScopeRepresentation(); scopeRep.setName("foo-scope"); String scopeId = createClientScope(scopeRep); // Add client with the clientScope ClientRepresentation clientRep = new ClientRepresentation(); clientRep.setClientId("bar-client"); clientRep.setName("bar-client"); clientRep.setProtocol("openid-connect"); clientRep.setDefaultClientScopes(Collections.singletonList("foo-scope")); String clientDbId = createClient(clientRep); // Can't remove clientScope try { clientScopes().get(scopeId).remove(); Assert.fail("Not expected to successfully remove clientScope in use"); } catch (BadRequestException bre) { ErrorRepresentation error = bre.getResponse().readEntity(ErrorRepresentation.class); Assert.assertEquals("Cannot remove client scope, it is currently in use", error.getErrorMessage()); assertAdminEvents.assertEmpty(); } // Remove client removeClient(clientDbId); // Can remove clientScope now removeClientScope(scopeId); }
Example 6
Source File: InvalidationCrossDCTest.java From keycloak with Apache License 2.0 | 5 votes |
@Test public void clientInvalidationTest() throws Exception { enableDcOnLoadBalancer(DC.FIRST); enableDcOnLoadBalancer(DC.SECOND); ClientResource clientResourceDc0 = ApiUtil.findClientByClientId(getAdminClientForStartedNodeInDc(0).realms().realm(REALM_NAME), "named-test-app"); ClientResource clientResourceDc1 = ApiUtil.findClientByClientId(getAdminClientForStartedNodeInDc(1).realms().realm(REALM_NAME), "named-test-app"); ClientRepresentation clientDc0 = clientResourceDc0.toRepresentation(); ClientRepresentation clientDc1 = clientResourceDc1.toRepresentation(); // Test same client on both DCs Assert.assertEquals("My Named Test App", clientDc0.getName()); Assert.assertEquals("My Named Test App", clientDc1.getName()); // Update client on DC0 clientDc0.setName("Changed Test App"); clientResourceDc0.update(clientDc0); // Assert updated on both DC0 and DC1 (here retry is needed. We need to wait until invalidation message arrives) clientDc0 = clientResourceDc0.toRepresentation(); Assert.assertEquals("Changed Test App", clientDc0.getName()); AtomicInteger i = new AtomicInteger(0); Retry.execute(() -> { i.incrementAndGet(); ClientRepresentation clientDcc1 = clientResourceDc1.toRepresentation(); Assert.assertEquals("Changed Test App", clientDcc1.getName()); }, 50, 50); log.infof("clientInvalidationTest: Passed after '%d' iterations", i.get()); }
Example 7
Source File: ClientInvalidationClusterTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override protected ClientRepresentation testEntityUpdates(ClientRepresentation client, boolean backendFailover) { // clientId client.setClientId(client.getClientId() + "_updated"); client = updateEntityOnCurrentFailNode(client, "clientId"); verifyEntityUpdateDuringFailover(client, backendFailover); // name client.setName(client.getName() + "_updated"); client = updateEntityOnCurrentFailNode(client, "name"); verifyEntityUpdateDuringFailover(client, backendFailover); return client; }
Example 8
Source File: ClientInvalidationClusterTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override protected ClientRepresentation createTestEntityRepresentation() { ClientRepresentation client = new ClientRepresentation(); String s = RandomStringUtils.randomAlphabetic(5); client.setClientId("client_" + s); client.setName("name_" + s); return client; }
Example 9
Source File: BrokerTestTools.java From keycloak with Apache License 2.0 | 5 votes |
public static void createKcOidcBroker(Keycloak adminClient, String childRealm, String idpRealm, String alias, boolean linkOnly) { IdentityProviderRepresentation idp = createIdentityProvider(alias, IDP_OIDC_PROVIDER_ID); idp.setLinkOnly(linkOnly); idp.setStoreToken(true); Map<String, String> config = idp.getConfig(); config.put("clientId", childRealm); config.put("clientSecret", childRealm); config.put("authorizationUrl", getProviderRoot() + "/auth/realms/" + idpRealm + "/protocol/openid-connect/auth"); config.put("tokenUrl", getProviderRoot() + "/auth/realms/" + idpRealm + "/protocol/openid-connect/token"); config.put("logoutUrl", getProviderRoot() + "/auth/realms/" + idpRealm + "/protocol/openid-connect/logout"); config.put("userInfoUrl", getProviderRoot() + "/auth/realms/" + idpRealm + "/protocol/openid-connect/userinfo"); config.put("backchannelSupported", "true"); adminClient.realm(childRealm).identityProviders().create(idp); ClientRepresentation client = new ClientRepresentation(); client.setClientId(childRealm); client.setName(childRealm); client.setSecret(childRealm); client.setEnabled(true); client.setRedirectUris(Collections.singletonList(getConsumerRoot() + "/auth/realms/" + childRealm + "/broker/" + idpRealm + "/endpoint/*")); client.setAdminUrl(getConsumerRoot() + "/auth/realms/" + childRealm + "/broker/" + idpRealm + "/endpoint"); adminClient.realm(idpRealm).clients().create(client); }
Example 10
Source File: ClientRegistrationTest.java From keycloak with Apache License 2.0 | 5 votes |
@Test public void updateClientWithNonAsciiChars() throws ClientRegistrationException { authCreateClients(); registerClient(); authManageClients(); ClientRepresentation client = reg.get(CLIENT_ID); String name = "Cli\u00EBnt"; client.setName(name); ClientRepresentation updatedClient = reg.update(client); assertEquals(name, updatedClient.getName()); }
Example 11
Source File: ClientRegistrationTest.java From keycloak with Apache License 2.0 | 5 votes |
@Test public void registerClientWithNonAsciiChars() throws ClientRegistrationException { authCreateClients(); ClientRepresentation client = buildClient(); String name = "Cli\u00EBnt"; client.setName(name); ClientRepresentation createdClient = registerClient(client); assertEquals(name, createdClient.getName()); }
Example 12
Source File: ReferrerTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { super.addTestRealms(testRealms); RealmRepresentation testRealm = testRealms.get(0); ClientRepresentation testClient = new ClientRepresentation(); testClient.setClientId(FAKE_CLIENT_ID); testClient.setName(LOCALE_CLIENT_NAME); testClient.setRedirectUris(Collections.singletonList(getFakeClientUrl())); testClient.setEnabled(true); testRealm.setClients(Collections.singletonList(testClient)); testRealm.setAccountTheme(LOCALIZED_THEME_PREVIEW); // using localized custom theme for the fake client localized name }
Example 13
Source File: PartialImportTest.java From keycloak with Apache License 2.0 | 5 votes |
private void addClients(boolean withServiceAccounts) throws IOException { List<ClientRepresentation> clients = new ArrayList<>(); List<UserRepresentation> serviceAccounts = new ArrayList<>(); for (int i = 0; i < NUM_ENTITIES; i++) { ClientRepresentation client = new ClientRepresentation(); client.setClientId(CLIENT_PREFIX + i); client.setName(CLIENT_PREFIX + i); clients.add(client); if (withServiceAccounts) { client.setServiceAccountsEnabled(true); client.setBearerOnly(false); client.setPublicClient(false); client.setAuthorizationSettings(resourceServerSampleSettings); client.setAuthorizationServicesEnabled(true); // create the user service account UserRepresentation serviceAccount = new UserRepresentation(); serviceAccount.setUsername(ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX + client.getClientId()); serviceAccount.setEnabled(true); serviceAccount.setEmail(serviceAccount.getUsername() + "@placeholder.org"); serviceAccount.setServiceAccountClientId(client.getClientId()); serviceAccounts.add(serviceAccount); } } if (withServiceAccounts) { if (piRep.getUsers() == null) { piRep.setUsers(new ArrayList<>()); } piRep.getUsers().addAll(serviceAccounts); } piRep.setClients(clients); }
Example 14
Source File: PartialImportTest.java From keycloak with Apache License 2.0 | 5 votes |
@Before public void createClientForClientRoles() { ClientRepresentation client = new ClientRepresentation(); client.setClientId(CLIENT_ROLES_CLIENT); client.setName(CLIENT_ROLES_CLIENT); client.setProtocol("openid-connect"); try (Response resp = testRealmResource().clients().create(client)) { // for some reason, findAll() will later fail unless readEntity is called here resp.readEntity(String.class); //testRealmResource().clients().findAll(); } }
Example 15
Source File: AbstractClientTest.java From keycloak with Apache License 2.0 | 5 votes |
protected String createSamlClient(String name) { ClientRepresentation clientRep = new ClientRepresentation(); clientRep.setClientId(name); clientRep.setName(name); clientRep.setProtocol("saml"); return createClient(clientRep); }
Example 16
Source File: AbstractClientTest.java From keycloak with Apache License 2.0 | 5 votes |
protected ClientRepresentation createOidcClientRep(String name) { ClientRepresentation clientRep = new ClientRepresentation(); clientRep.setClientId(name); clientRep.setName(name); clientRep.setProtocol("openid-connect"); return clientRep; }
Example 17
Source File: RealmSetup.java From keycloak-custom-protocol-mapper-example with Apache License 2.0 | 5 votes |
private List<ClientRepresentation> createClients() { ClientRepresentation client = new ClientRepresentation(); client.setEnabled(true); // normally you wouldn't do this, but we use the direct grant to be able // to fetch the token for demo purposes per curl ;-) client.setDirectAccessGrantsEnabled(true); client.setId(CLIENT); client.setName(CLIENT); client.setPublicClient(Boolean.TRUE); return Arrays.asList(client); }
Example 18
Source File: UserTest.java From keycloak with Apache License 2.0 | 4 votes |
@Test @AuthServerContainerExclude(AuthServer.REMOTE) public void sendResetPasswordEmailWithRedirect() throws IOException { UserRepresentation userRep = new UserRepresentation(); userRep.setEnabled(true); userRep.setUsername("user1"); userRep.setEmail("[email protected]"); String id = createUser(userRep); UserResource user = realm.users().get(id); ClientRepresentation client = new ClientRepresentation(); client.setClientId("myclient"); client.setRedirectUris(new LinkedList<>()); client.getRedirectUris().add("http://myclient.com/*"); client.setName("myclient"); client.setEnabled(true); Response response = realm.clients().create(client); String createdId = ApiUtil.getCreatedId(response); assertAdminEvents.assertEvent(realmId, OperationType.CREATE, AdminEventPaths.clientResourcePath(createdId), client, ResourceType.CLIENT); List<String> actions = new LinkedList<>(); actions.add(UserModel.RequiredAction.UPDATE_PASSWORD.name()); try { // test that an invalid redirect uri is rejected. user.executeActionsEmail("myclient", "http://unregistered-uri.com/", actions); fail("Expected failure"); } catch (ClientErrorException e) { assertEquals(400, e.getResponse().getStatus()); ErrorRepresentation error = e.getResponse().readEntity(ErrorRepresentation.class); Assert.assertEquals("Invalid redirect uri.", error.getErrorMessage()); } user.executeActionsEmail("myclient", "http://myclient.com/home.html", actions); assertAdminEvents.assertEvent(realmId, OperationType.ACTION, AdminEventPaths.userResourcePath(id) + "/execute-actions-email", ResourceType.USER); Assert.assertEquals(1, greenMail.getReceivedMessages().length); MimeMessage message = greenMail.getReceivedMessages()[0]; String link = MailUtils.getPasswordResetEmailLink(message); driver.navigate().to(link); proceedPage.assertCurrent(); Assert.assertThat(proceedPage.getInfo(), Matchers.containsString("Update Password")); proceedPage.clickProceedLink(); passwordUpdatePage.assertCurrent(); passwordUpdatePage.changePassword("new-pass", "new-pass"); assertEquals("Your account has been updated.", driver.findElement(By.id("kc-page-title")).getText()); String pageSource = driver.getPageSource(); // check to make sure the back link is set. Assert.assertTrue(pageSource.contains("http://myclient.com/home.html")); driver.navigate().to(link); assertEquals("We are sorry...", PageUtils.getPageTitle(driver)); }
Example 19
Source File: KcOidcBrokerConfiguration.java From keycloak with Apache License 2.0 | 4 votes |
@Override public List<ClientRepresentation> createProviderClients() { ClientRepresentation client = new ClientRepresentation(); client.setId(CLIENT_ID); client.setClientId(getIDPClientIdInProviderRealm()); client.setName(CLIENT_ID); client.setSecret(CLIENT_SECRET); client.setEnabled(true); client.setRedirectUris(Collections.singletonList(getConsumerRoot() + "/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint/*")); client.setAdminUrl(getConsumerRoot() + "/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint"); ProtocolMapperRepresentation emailMapper = new ProtocolMapperRepresentation(); emailMapper.setName("email"); emailMapper.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); emailMapper.setProtocolMapper(UserPropertyMapper.PROVIDER_ID); Map<String, String> emailMapperConfig = emailMapper.getConfig(); emailMapperConfig.put(ProtocolMapperUtils.USER_ATTRIBUTE, "email"); emailMapperConfig.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, "email"); emailMapperConfig.put(OIDCAttributeMapperHelper.JSON_TYPE, ProviderConfigProperty.STRING_TYPE); emailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ACCESS_TOKEN, "true"); emailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); emailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_USERINFO, "true"); ProtocolMapperRepresentation nestedAttrMapper = new ProtocolMapperRepresentation(); nestedAttrMapper.setName("attribute - nested claim"); nestedAttrMapper.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); nestedAttrMapper.setProtocolMapper(UserAttributeMapper.PROVIDER_ID); Map<String, String> nestedEmailMapperConfig = nestedAttrMapper.getConfig(); nestedEmailMapperConfig.put(ProtocolMapperUtils.USER_ATTRIBUTE, "nested.email"); nestedEmailMapperConfig.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, "nested.email"); nestedEmailMapperConfig.put(OIDCAttributeMapperHelper.JSON_TYPE, ProviderConfigProperty.STRING_TYPE); nestedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ACCESS_TOKEN, "true"); nestedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); nestedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_USERINFO, "true"); ProtocolMapperRepresentation dottedAttrMapper = new ProtocolMapperRepresentation(); dottedAttrMapper.setName("attribute - claim with dot in name"); dottedAttrMapper.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); dottedAttrMapper.setProtocolMapper(UserAttributeMapper.PROVIDER_ID); Map<String, String> dottedEmailMapperConfig = dottedAttrMapper.getConfig(); dottedEmailMapperConfig.put(ProtocolMapperUtils.USER_ATTRIBUTE, "dotted.email"); dottedEmailMapperConfig.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, "dotted\\.email"); dottedEmailMapperConfig.put(OIDCAttributeMapperHelper.JSON_TYPE, ProviderConfigProperty.STRING_TYPE); dottedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ACCESS_TOKEN, "true"); dottedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); dottedEmailMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_USERINFO, "true"); ProtocolMapperRepresentation userAttrMapper = new ProtocolMapperRepresentation(); userAttrMapper.setName("attribute - name"); userAttrMapper.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); userAttrMapper.setProtocolMapper(UserAttributeMapper.PROVIDER_ID); Map<String, String> userAttrMapperConfig = userAttrMapper.getConfig(); userAttrMapperConfig.put(ProtocolMapperUtils.USER_ATTRIBUTE, ATTRIBUTE_TO_MAP_NAME); userAttrMapperConfig.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, ATTRIBUTE_TO_MAP_NAME); userAttrMapperConfig.put(OIDCAttributeMapperHelper.JSON_TYPE, ProviderConfigProperty.STRING_TYPE); userAttrMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ACCESS_TOKEN, "true"); userAttrMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); userAttrMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_USERINFO, "true"); userAttrMapperConfig.put(ProtocolMapperUtils.MULTIVALUED, "true"); ProtocolMapperRepresentation userAttrMapper2 = new ProtocolMapperRepresentation(); userAttrMapper2.setName("attribute - name - 2"); userAttrMapper2.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); userAttrMapper2.setProtocolMapper(UserAttributeMapper.PROVIDER_ID); Map<String, String> userAttrMapperConfig2 = userAttrMapper2.getConfig(); userAttrMapperConfig2.put(ProtocolMapperUtils.USER_ATTRIBUTE, ATTRIBUTE_TO_MAP_NAME_2); userAttrMapperConfig2.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, ATTRIBUTE_TO_MAP_NAME_2); userAttrMapperConfig2.put(OIDCAttributeMapperHelper.JSON_TYPE, ProviderConfigProperty.STRING_TYPE); userAttrMapperConfig2.put(OIDCAttributeMapperHelper.INCLUDE_IN_ACCESS_TOKEN, "true"); userAttrMapperConfig2.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); userAttrMapperConfig2.put(OIDCAttributeMapperHelper.INCLUDE_IN_USERINFO, "true"); userAttrMapperConfig2.put(ProtocolMapperUtils.MULTIVALUED, "true"); ProtocolMapperRepresentation hardcodedJsonClaim = new ProtocolMapperRepresentation(); hardcodedJsonClaim.setName("json-mapper"); hardcodedJsonClaim.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); hardcodedJsonClaim.setProtocolMapper(HardcodedClaim.PROVIDER_ID); Map<String, String> hardcodedJsonClaimMapperConfig = hardcodedJsonClaim.getConfig(); hardcodedJsonClaimMapperConfig.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, KcOidcBrokerConfiguration.USER_INFO_CLAIM); hardcodedJsonClaimMapperConfig.put(OIDCAttributeMapperHelper.JSON_TYPE, "JSON"); hardcodedJsonClaimMapperConfig.put(OIDCAttributeMapperHelper.INCLUDE_IN_ID_TOKEN, "true"); hardcodedJsonClaimMapperConfig.put(HardcodedClaim.CLAIM_VALUE, "{\"" + HARDOCDED_CLAIM + "\": \"" + HARDOCDED_VALUE + "\"}"); client.setProtocolMappers(Arrays.asList(emailMapper, userAttrMapper, userAttrMapper2, nestedAttrMapper, dottedAttrMapper, hardcodedJsonClaim)); return Collections.singletonList(client); }
Example 20
Source File: FineGrainAdminUnitTest.java From keycloak with Apache License 2.0 | 4 votes |
@Test public void testCreateRealmCreateClient() throws Exception { ClientRepresentation rep = new ClientRepresentation(); rep.setName("fullScopedClient"); rep.setClientId("fullScopedClient"); rep.setFullScopeAllowed(true); rep.setSecret("618268aa-51e6-4e64-93c4-3c0bc65b8171"); rep.setProtocol("openid-connect"); rep.setPublicClient(false); rep.setEnabled(true); adminClient.realm("master").clients().create(rep); Keycloak realmClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), "master", "admin", "admin", "fullScopedClient", "618268aa-51e6-4e64-93c4-3c0bc65b8171"); try { RealmRepresentation newRealm=new RealmRepresentation(); newRealm.setRealm("anotherRealm"); newRealm.setId("anotherRealm"); newRealm.setEnabled(true); realmClient.realms().create(newRealm); ClientRepresentation newClient = new ClientRepresentation(); newClient.setName("newClient"); newClient.setClientId("newClient"); newClient.setFullScopeAllowed(true); newClient.setSecret("secret"); newClient.setProtocol("openid-connect"); newClient.setPublicClient(false); newClient.setEnabled(true); Response response = realmClient.realm("anotherRealm").clients().create(newClient); Assert.assertEquals(403, response.getStatus()); realmClient.close(); realmClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), "master", "admin", "admin", "fullScopedClient", "618268aa-51e6-4e64-93c4-3c0bc65b8171"); response = realmClient.realm("anotherRealm").clients().create(newClient); Assert.assertEquals(201, response.getStatus()); } finally { adminClient.realm("anotherRealm").remove(); realmClient.close(); } }