Class ImportUtils

    • Constructor Summary

      Constructors 
      Constructor Description
      ImportUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Map<String,​org.keycloak.representations.idm.RealmRepresentation> getRealmsFromStream​(com.fasterxml.jackson.databind.ObjectMapper mapper, InputStream is)  
      static void importFederatedUsersFromStream​(org.keycloak.models.KeycloakSession session, String realmName, com.fasterxml.jackson.databind.ObjectMapper mapper, InputStream is)  
      static void importFromStream​(org.keycloak.models.KeycloakSession session, com.fasterxml.jackson.databind.ObjectMapper mapper, InputStream is, org.keycloak.exportimport.Strategy strategy)
      Fully import realm (or more realms from particular stream)
      static boolean importRealm​(org.keycloak.models.KeycloakSession session, org.keycloak.representations.idm.RealmRepresentation rep, org.keycloak.exportimport.Strategy strategy, boolean skipUserDependent)
      Fully import realm from representation, save it to model and return model of newly created realm
      static void importRealms​(org.keycloak.models.KeycloakSession session, Collection<org.keycloak.representations.idm.RealmRepresentation> realms, org.keycloak.exportimport.Strategy strategy)  
      static void importUsersFromStream​(org.keycloak.models.KeycloakSession session, String realmName, com.fasterxml.jackson.databind.ObjectMapper mapper, InputStream is)  
    • Constructor Detail

      • ImportUtils

        public ImportUtils()
    • Method Detail

      • importRealms

        public static void importRealms​(org.keycloak.models.KeycloakSession session,
                                        Collection<org.keycloak.representations.idm.RealmRepresentation> realms,
                                        org.keycloak.exportimport.Strategy strategy)
      • importRealm

        public static boolean importRealm​(org.keycloak.models.KeycloakSession session,
                                          org.keycloak.representations.idm.RealmRepresentation rep,
                                          org.keycloak.exportimport.Strategy strategy,
                                          boolean skipUserDependent)
        Fully import realm from representation, save it to model and return model of newly created realm
        Parameters:
        session -
        rep -
        strategy - specifies whether to overwrite or ignore existing realm or user entries
        skipUserDependent - If true, then import of any models, which needs users already imported in DB, will be skipped. For example authorization
        Returns:
        newly imported realm (or existing realm if ignoreExisting is true and realm of this name already exists)
      • importFromStream

        public static void importFromStream​(org.keycloak.models.KeycloakSession session,
                                            com.fasterxml.jackson.databind.ObjectMapper mapper,
                                            InputStream is,
                                            org.keycloak.exportimport.Strategy strategy)
                                     throws IOException
        Fully import realm (or more realms from particular stream)
        Parameters:
        session -
        mapper -
        is -
        strategy -
        Throws:
        IOException
      • getRealmsFromStream

        public static Map<String,​org.keycloak.representations.idm.RealmRepresentation> getRealmsFromStream​(com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                                                                                 InputStream is)
                                                                                                          throws IOException
        Throws:
        IOException
      • importUsersFromStream

        public static void importUsersFromStream​(org.keycloak.models.KeycloakSession session,
                                                 String realmName,
                                                 com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                 InputStream is)
                                          throws IOException
        Throws:
        IOException
      • importFederatedUsersFromStream

        public static void importFederatedUsersFromStream​(org.keycloak.models.KeycloakSession session,
                                                          String realmName,
                                                          com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                          InputStream is)
                                                   throws IOException
        Throws:
        IOException