8000 Not possible to sync latest keycloak-admin-client to keycloak-client by mposolda · Pull Request #47950 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.keycloak.admin.client;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.Iterator;
import java.util.ServiceLoader;
Expand All @@ -32,7 +34,6 @@
import org.keycloak.admin.client.resource.ServerInfoResource;
import org.keycloak.admin.client.spi.ResteasyClientProvider;
import org.keycloak.admin.client.token.TokenManager;
import org.keycloak.admin.client.wrapper.Clients;

import static org.keycloak.OAuth2Constants.PASSWORD;

Expand Down Expand Up @@ -242,7 +243,20 @@ public boolean isClosed() {
return closed;
}

public Clients clients(String realmName) {
return new Clients(CLIENT_PROVIDER, target, realmName);
/**
* Method to return org.keycloak.admin.client.wrapper.Clients instance. Note that this class
* may not be available in some cases and hence reflection is used to instantiate that class
*
* @param realmName realm name
* @param clientsClass Typically class org.keycloak.admin.client.wrapper.Clients . This argument is present just to avoid casting.
* @return Instance of org.keycloak.admin.client.wrapper.Clients
*/
public <C> C clients(String realmName, Class<C> clientsClass) {
try {
Constructor<C> constructor = clientsClass.getDeclaredConstructor(ResteasyClientProvider.class, WebTarget.class, String.class);
return constructor.newInstance(CLIENT_PROVIDER, target, realmName);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}
Loading
Loading
0