org.keycloak.exportimport.util

## Class ExportUtils

- java.lang.Object
- - org.keycloak.exportimport.util.ExportUtils

-     public class ExportUtils
      extends Object

  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExportUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ResourceServerRepresentation` | `exportAuthorizationSettings(KeycloakSession session, ClientModel client)`
    `static ClientRepresentation` | `exportClient(KeycloakSession session, ClientModel client)` Full export of application including claims and secret
    `static MultivaluedHashMap<String,ComponentExportRepresentation>` | `exportComponents(RealmModel realm, String parentId)`
    `static CredentialRepresentation` | `exportCredential(CredentialModel userCred)`
    `static UserRepresentation` | `exportFederatedUser(KeycloakSession session, RealmModel realm, String id, ExportOptions options)` Full export of user data stored in federated storage (including role mappings and credentials)
    `static void` | `exportFederatedUsersToStream(KeycloakSession session, RealmModel realm, List<String> usersToExport, com.fasterxml.jackson.databind.ObjectMapper mapper, OutputStream os)`
    `static void` | `exportFederatedUsersToStream(KeycloakSession session, RealmModel realm, List<String> usersToExport, com.fasterxml.jackson.databind.ObjectMapper mapper, OutputStream os, ExportOptions options)`
    `static RealmRepresentation` | `exportRealm(KeycloakSession session, RealmModel realm, boolean includeUsers, boolean internal)`
    `static RealmRepresentation` | `exportRealm(KeycloakSession session, RealmModel realm, ExportOptions options, boolean internal)`
    `static RoleRepresentation` | `exportRole(RoleModel role)` Full export of role including composite roles
    `static List<RoleRepresentation>` | `exportRoles(Stream<RoleModel> roles)`
    `static FederatedIdentityRepresentation` | `exportSocialLink(FederatedIdentityModel socialLink)`
    `static UserRepresentation` | `exportUser(KeycloakSession session, RealmModel realm, UserModel user, ExportOptions options, boolean internal)` Full export of user (including role mappings and credentials)
    `static void` | `exportUsersToStream(KeycloakSession session, RealmModel realm, List<UserModel> usersToExport, com.fasterxml.jackson.databind.ObjectMapper mapper, OutputStream os)`
    `static void` | `exportUsersToStream(KeycloakSession session, RealmModel realm, List<UserModel> usersToExport, com.fasterxml.jackson.databind.ObjectMapper mapper, OutputStream os, ExportOptions options)`
    `static List<String>` | `getRoleNames(Collection<RoleModel> roles)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExportUtils

          public ExportUtils()

  - ### Method Detail

    - #### exportRealm

          public static RealmRepresentation exportRealm(KeycloakSession session,
                                                        RealmModel realm,
                                                        boolean includeUsers,
                                                        boolean internal)

    - #### exportRealm

          public static RealmRepresentation exportRealm(KeycloakSession session,
                                                        RealmModel realm,
                                                        ExportOptions options,
                                                        boolean internal)

    - #### exportComponents

          public static MultivaluedHashMap<String,ComponentExportRepresentation> exportComponents(RealmModel realm,
                                                                                                  String parentId)

    - #### exportClient

          public static ClientRepresentation exportClient(KeycloakSession session,
                                                          ClientModel client)

      Full export of application including claims and secret
      Parameters:
        `client` -
      Returns:
        full ApplicationRepresentation

    - #### exportAuthorizationSettings

          public static ResourceServerRepresentation exportAuthorizationSettings(KeycloakSession session,
                                                                                 ClientModel client)

    - #### exportRoles

          public static List<RoleRepresentation> exportRoles(Stream<RoleModel> roles)

    - #### getRoleNames

          public static List<String> getRoleNames(Collection<RoleModel> roles)

    - #### exportRole

          public static RoleRepresentation exportRole(RoleModel role)

      Full export of role including composite roles
      Parameters:
        `role` -
      Returns:
        RoleRepresentation with all stuff filled (including composite roles)

    - #### exportUser

          public static UserRepresentation exportUser(KeycloakSession session,
                                                      RealmModel realm,
                                                      UserModel user,
                                                      ExportOptions options,
                                                      boolean internal)

      Full export of user (including role mappings and credentials)
      Parameters:
        `user` -
      Returns:
        fully exported user representation

    - #### exportSocialLink

          public static FederatedIdentityRepresentation exportSocialLink(FederatedIdentityModel socialLink)

    - #### exportCredential

          public static CredentialRepresentation exportCredential(CredentialModel userCred)

    - #### exportUsersToStream

          public static void exportUsersToStream(KeycloakSession session,
                                                 RealmModel realm,
                                                 List<UserModel> usersToExport,
                                                 com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                 OutputStream os)
                                          throws IOException

      Throws:
        `IOException`

    - #### exportUsersToStream

          public static void exportUsersToStream(KeycloakSession session,
                                                 RealmModel realm,
                                                 List<UserModel> usersToExport,
                                                 com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                 OutputStream os,
                                                 ExportOptions options)
                                          throws IOException

      Throws:
        `IOException`

    - #### exportFederatedUsersToStream

          public static void exportFederatedUsersToStream(KeycloakSession session,
                                                          RealmModel realm,
                                                          List<String> usersToExport,
                                                          com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                          OutputStream os)
                                                   throws IOException

      Throws:
        `IOException`

    - #### exportFederatedUsersToStream

          public static void exportFederatedUsersToStream(KeycloakSession session,
                                                          RealmModel realm,
                                                          List<String> usersToExport,
                                                          com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                          OutputStream os,
                                                          ExportOptions options)
                                                   throws IOException

      Throws:
        `IOException`

    - #### exportFederatedUser

          public static UserRepresentation exportFederatedUser(KeycloakSession session,
                                                               RealmModel realm,
                                                               String id,
                                                               ExportOptions options)

      Full export of user data stored in federated storage (including role mappings and credentials)
      Parameters:
        `id` -
      Returns:
        fully exported user representation

Copyright © 2021 JBoss by Red Hat. All rights reserved.