/** Get configuration descriptions for all clients */
  @Path("per-client-config-description")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @NoCache
  public Map<String, List<ConfigPropertyRepresentation>> getPerClientConfigDescription() {
    auth.requireAny();

    List<ProviderFactory> factories =
        session.getKeycloakSessionFactory().getProviderFactories(ClientAuthenticator.class);

    Map<String, List<ConfigPropertyRepresentation>> toReturn = new HashMap<>();
    for (ProviderFactory clientAuthenticatorFactory : factories) {
      String providerId = clientAuthenticatorFactory.getId();
      ConfigurableAuthenticatorFactory factory =
          CredentialHelper.getConfigurableAuthenticatorFactory(session, providerId);
      ClientAuthenticatorFactory clientAuthFactory = (ClientAuthenticatorFactory) factory;
      List<ProviderConfigProperty> perClientConfigProps =
          clientAuthFactory.getConfigPropertiesPerClient();
      List<ConfigPropertyRepresentation> result = new LinkedList<>();
      for (ProviderConfigProperty prop : perClientConfigProps) {
        ConfigPropertyRepresentation propRep = getConfigPropertyRep(prop);
        result.add(propRep);
      }

      toReturn.put(providerId, result);
    }

    return toReturn;
  }
Exemple #2
0
 private Map<String, Object> getClientCredentialsAdapterConfig(ClientModel client) {
   String clientAuthenticator = client.getClientAuthenticatorType();
   ClientAuthenticatorFactory authenticator =
       (ClientAuthenticatorFactory)
           realmManager
               .getSession()
               .getKeycloakSessionFactory()
               .getProviderFactory(ClientAuthenticator.class, clientAuthenticator);
   return authenticator.getAdapterConfiguration(client);
 }