Search in sources :

Example 11 with KeycloakUriBuilder

use of org.keycloak.common.util.KeycloakUriBuilder in project keycloak by keycloak.

the class ResourceAdminManager method getAllManagementUrls.

// For non-cluster setup, return just single configured managementUrls
// For cluster setup, return the management Urls corresponding to all registered cluster nodes
private List<String> getAllManagementUrls(ClientModel client) {
    String baseMgmtUrl = getManagementUrl(session, client);
    if (baseMgmtUrl == null) {
        return Collections.emptyList();
    }
    Set<String> registeredNodesHosts = new ClientManager().validateRegisteredNodes(client);
    // No-cluster setup
    if (registeredNodesHosts.isEmpty()) {
        return Arrays.asList(baseMgmtUrl);
    }
    List<String> result = new LinkedList<String>();
    KeycloakUriBuilder uriBuilder = KeycloakUriBuilder.fromUri(baseMgmtUrl);
    for (String nodeHost : registeredNodesHosts) {
        String currentNodeUri = uriBuilder.clone().host(nodeHost).build().toString();
        result.add(currentNodeUri);
    }
    return result;
}
Also used : KeycloakUriBuilder(org.keycloak.common.util.KeycloakUriBuilder) LinkedList(java.util.LinkedList)

Aggregations

KeycloakUriBuilder (org.keycloak.common.util.KeycloakUriBuilder)11 URI (java.net.URI)3 LinkedList (java.util.LinkedList)3 InvalidKeyException (java.security.InvalidKeyException)2 SignatureException (java.security.SignatureException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ProcessingException (org.keycloak.saml.common.exceptions.ProcessingException)2 ServletRequestContext (io.undertow.servlet.handlers.ServletRequestContext)1 HttpSessionImpl (io.undertow.servlet.spec.HttpSessionImpl)1 IOException (java.io.IOException)1 KeyManagementException (java.security.KeyManagementException)1 Signature (java.security.Signature)1 VerificationException (org.keycloak.common.VerificationException)1 OIDCConfigurationRepresentation (org.keycloak.protocol.oidc.representations.OIDCConfigurationRepresentation)1 SignatureAlgorithm (org.keycloak.saml.SignatureAlgorithm)1 ConfigurationException (org.keycloak.saml.common.exceptions.ConfigurationException)1 SAML2Signature (org.keycloak.saml.processing.api.saml.v2.sig.SAML2Signature)1 AbstractResourceService (org.keycloak.services.resources.account.resources.AbstractResourceService)1