Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-8857

Provide utility to create AuthzClient from InputStream like you can create KeycloakDeployment using InputStream

    Details

      Description

      Currently there are three ways you can create AuthzClient:

          1. public static AuthzClient create() 
      
          2. public static AuthzClient create(Configuration configuration)
         
        3.  public static AuthzClient create(Configuration configuration, ClientAuthenticator 
      

      1. First expect `keycloak.json` file to be available, but most of the cases consumers of keycloak library would want to hide reference to keycloak
      2. Second expect `Configuration` which is difficult to create and at the same time exposes keycloak
      3. similar to 2

      Suggestion

      
          public static AuthzClient create(InputStream is) throws RuntimeException {
              if (is == null) {
                  throw new RuntimeException("Could not find any keycloak.json file in classpath.");
              }
      
              try {
                  return create(JsonSerialization.readValue(is, Configuration.class));
              } catch (IOException e) {
                  throw new RuntimeException("Could not parse configuration.", e);
              }
          }
      

      This is similar to how you create `KeycloakDeployment`

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                pcraveiro Pedro Igor Silva
                Reporter:
                kpritam Pritam Kadam
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: