use of org.keycloak.representations.idm.ComponentRepresentation in project keycloak by keycloak.
the class ClientStorageTest method addProvidersBeforeTest.
@Before
public void addProvidersBeforeTest() throws URISyntaxException, IOException {
ComponentRepresentation provider = new ComponentRepresentation();
provider.setName("client-storage-hardcoded");
provider.setProviderId(HardcodedClientStorageProviderFactory.PROVIDER_ID);
provider.setProviderType(ClientStorageProvider.class.getName());
provider.setConfig(new MultivaluedHashMap<>());
provider.getConfig().putSingle(HardcodedClientStorageProviderFactory.CLIENT_ID, "hardcoded-client");
provider.getConfig().putSingle(HardcodedClientStorageProviderFactory.REDIRECT_URI, oauth.getRedirectUri());
provider.getConfig().putSingle(HardcodedClientStorageProviderFactory.DELAYED_SEARCH, Boolean.toString(false));
providerId = addComponent(provider);
}
use of org.keycloak.representations.idm.ComponentRepresentation in project keycloak by keycloak.
the class RoleStorageTest method addProvidersBeforeTest.
@Before
public void addProvidersBeforeTest() throws URISyntaxException, IOException {
ComponentRepresentation provider = new ComponentRepresentation();
provider.setName("role-storage-hardcoded");
provider.setProviderId(HardcodedRoleStorageProviderFactory.PROVIDER_ID);
provider.setProviderType(RoleStorageProvider.class.getName());
provider.setConfig(new MultivaluedHashMap<>());
provider.getConfig().putSingle(HardcodedRoleStorageProviderFactory.ROLE_NAME, "hardcoded-role");
provider.getConfig().putSingle(HardcodedRoleStorageProviderFactory.DELAYED_SEARCH, Boolean.toString(false));
providerId = addComponent(provider);
}
use of org.keycloak.representations.idm.ComponentRepresentation in project keycloak by keycloak.
the class LdapUserFederationTest method configureConnectionPooling.
@Test
public void configureConnectionPooling() {
createLdapUserProvider.navigateTo();
createLdapUserProvider.form().selectVendor(ACTIVE_DIRECTORY);
createLdapUserProvider.form().setConsoleDisplayNameInput("ldap");
createLdapUserProvider.form().selectEditMode(WRITABLE);
createLdapUserProvider.form().setLdapConnectionUrlInput("ldap://localhost:389");
createLdapUserProvider.form().setLdapBindDnInput("KEYCLOAK/Administrator");
createLdapUserProvider.form().setLdapUserDnInput("ou=People,dc=keycloak,dc=org");
createLdapUserProvider.form().setLdapBindCredentialInput("secret");
createLdapUserProvider.form().connectionPoolingSettings();
createLdapUserProvider.form().setConnectionPoolingAuthentication("none");
createLdapUserProvider.form().setConnectionPoolingDebug("fine");
createLdapUserProvider.form().setConnectionPoolingInitSize("10");
createLdapUserProvider.form().setConnectionPoolingMaxSize("12");
createLdapUserProvider.form().setConnectionPoolingPrefSize("11");
createLdapUserProvider.form().setConnectionPoolingProtocol("ssl");
createLdapUserProvider.form().setConnectionPoolingTimeout("500");
createLdapUserProvider.form().save();
assertAlertSuccess();
ComponentRepresentation ufpr = testRealmResource().components().query(null, "org.keycloak.storage.UserStorageProvider").get(0);
assertLdapConnectionPoolSettings(ufpr, "none", "fine", "10", "12", "11", "ssl", "500");
}
use of org.keycloak.representations.idm.ComponentRepresentation in project keycloak by keycloak.
the class LdapUserFederationTest method configureAdProvider.
@Test
public void configureAdProvider() {
createLdapUserProvider.navigateTo();
createLdapUserProvider.form().selectVendor(ACTIVE_DIRECTORY);
createLdapUserProvider.form().setConsoleDisplayNameInput("ldap");
createLdapUserProvider.form().selectEditMode(WRITABLE);
createLdapUserProvider.form().setLdapConnectionUrlInput("ldap://localhost:389");
createLdapUserProvider.form().setLdapBindDnInput("KEYCLOAK/Administrator");
createLdapUserProvider.form().setLdapUserDnInput("ou=People,dc=keycloak,dc=org");
createLdapUserProvider.form().setLdapBindCredentialInput("secret");
// createLdapUserProvider.form().setAccountAfterPasswordUpdateEnabled(false);
// enable kerberos
createLdapUserProvider.form().uncollapseKerberosIntegrationHeader();
createLdapUserProvider.form().setAllowKerberosAuthEnabled(true);
createLdapUserProvider.form().setKerberosRealmInput("KEYCLOAK.ORG");
createLdapUserProvider.form().setServerPrincipalInput("HTTP/localhost@KEYCLOAK.ORG");
createLdapUserProvider.form().setKeyTabInput("http.keytab");
createLdapUserProvider.form().setDebugEnabled(true);
createLdapUserProvider.form().save();
assertAlertSuccess();
ComponentRepresentation ufpr = testRealmResource().components().query(null, "org.keycloak.storage.UserStorageProvider").get(0);
assertLdapProviderSetting(ufpr, "ldap", "0", WRITABLE, "false", "ad", "1", "true", "true", "false");
assertLdapBasicMapping(ufpr, "cn", "cn", "objectGUID", "person, organizationalPerson, user", "ou=People,dc=keycloak,dc=org");
assertLdapSyncSetings(ufpr, "1000", "-1", "-1");
assertLdapKerberosSetings(ufpr, "KEYCLOAK.ORG", "HTTP/localhost@KEYCLOAK.ORG", "http.keytab", "true", "false");
}
use of org.keycloak.representations.idm.ComponentRepresentation in project keycloak by keycloak.
the class RealmManager method generateNewRsaKey.
public String generateNewRsaKey(KeyPair keyPair, String name) {
RealmRepresentation rep = realm.toRepresentation();
Certificate certificate = CertificateUtils.generateV1SelfSignedCertificate(keyPair, "test");
String certificatePem = PemUtils.encodeCertificate(certificate);
ComponentRepresentation keyProviderRepresentation = new ComponentRepresentation();
keyProviderRepresentation.setName(name);
keyProviderRepresentation.setParentId(rep.getId());
keyProviderRepresentation.setProviderId(ImportedRsaKeyProviderFactory.ID);
keyProviderRepresentation.setProviderType(KeyProvider.class.getName());
MultivaluedHashMap<String, String> config = new MultivaluedHashMap<>();
config.putSingle(Attributes.PRIVATE_KEY_KEY, PemUtils.encodeKey(keyPair.getPrivate()));
config.putSingle(Attributes.CERTIFICATE_KEY, certificatePem);
config.putSingle(Attributes.PRIORITY_KEY, "100");
keyProviderRepresentation.setConfig(config);
Response response = realm.components().add(keyProviderRepresentation);
String providerId = ApiUtil.getCreatedId(response);
response.close();
deactivateOtherRsaKeys(providerId);
return providerId;
}
Aggregations