Class CustomKeycloakTask
java.lang.Object
org.keycloak.connections.jpa.updater.liquibase.custom.CustomKeycloakTask
- All Implemented Interfaces:
liquibase.change.custom.CustomChange,liquibase.change.custom.CustomSqlChange
- Direct Known Subclasses:
AbstractUserFedToComponent,AuthzResourceUseMoreURIs,ExtractRealmKeysFromRealmTable,FederatedUserAttributeTextColumnMigration,JpaUpdate1_2_0_Beta1,JpaUpdate1_2_0_CR1,JpaUpdate1_4_0_Final,JpaUpdate1_9_0_Final,JpaUpdate13_0_0_MigrateDefaultRoles,JpaUpdate14_0_0_MigrateSamlArtifactAttribute,JpaUpdate19_0_0_DefaultPostLogoutRedirectUri,JpaUpdate21_0_2_TermsAndConditionsRequiredAction,JpaUpdate22_0_0_RemoveRhssoThemes,JpaUpdate22_0_5_UpdateAccountTheme,JpaUpdate24_0_2_FederatedTermsAndConditionsRequiredAction,JpaUpdate25_0_0_ConsentConstraints,JpaUpdate25_0_0_MySQL_ConsentConstraints,JpaUpdate26_0_0_IdentityProviderAttributesMigration,JpaUpdate26_0_0_OrganizationGroupType,JpaUpdate26_2_6_RemoveDuplicateMigrationModelTime,JpaUpdate26_2_6_RemoveDuplicateMigrationModelVersion,JpaUpdate26_4_0_SamlEncryptionAttributes,JpaUpdate26_5_0_OrgTablesSetDefaultCharsetAndCollation,JpaUpdate26_6_0_OfflineClientSessionRealm,JpaUpdate26_7_0_RealmDisplayName,JpaUpdate26_8_0_BackfillGroupOrgId,JpaUpdate26_8_0_DomainIdpRoutingMigration,JpaUpdate26_8_0_IdpMapperOrganizationId,JpaUpdate26_8_0_PopulateOrgDomainRealmId,JpaUpdate27_0_0_LoginThemes,JpaUpdate27_0_0_OidcIssuerMigration,JpaUpdate4_0_0_DefaultClientScopes,JpaUpdate4_7_0_OfflineSessionsTimestamps,JpaUpdateAuthz_3_4_0_CR1,RemoveDuplicateOfflineSessions
public abstract class CustomKeycloakTask
extends Object
implements liquibase.change.custom.CustomSqlChange
- Author:
- Marek Posolda
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordLink of an identity provider to its organization, as stored before 26.8 when an IdP carried exactly one organization. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuilderprotected Connectionprotected liquibase.database.Databaseprotected liquibase.database.jvm.JdbcConnectionprotected KeycloakSessionprotected List<liquibase.statement.SqlStatement> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionliquibase.statement.SqlStatement[]generateStatements(liquibase.database.Database database) protected abstract voidIt's supposed to fill SQL statements to the "statements" variable and fill "confirmationMessage"protected List<CustomKeycloakTask.IdpOrganizationLink>Reads the identity provider to organization links of the database the task reads from.protected StringgetTableName(String tableName) protected abstract Stringprotected booleanChecks whether the column exists on the database the task reads from.protected booleanChecks whether the table exists on the database the task reads from, seehasColumn(String, String).protected booleanvoidsetFileOpener(liquibase.resource.ResourceAccessor resourceAccessor) voidsetUp()liquibase.exception.ValidationErrorsvalidate(liquibase.database.Database database)
-
Field Details
-
kcSession
-
database
protected liquibase.database.Database database -
jdbcConnection
protected liquibase.database.jvm.JdbcConnection jdbcConnection -
connection
-
confirmationMessage
-
statements
-
-
Constructor Details
-
CustomKeycloakTask
public CustomKeycloakTask()
-
-
Method Details
-
validate
public liquibase.exception.ValidationErrors validate(liquibase.database.Database database) - Specified by:
validatein interfaceliquibase.change.custom.CustomChange
-
setFileOpener
public void setFileOpener(liquibase.resource.ResourceAccessor resourceAccessor) - Specified by:
setFileOpenerin interfaceliquibase.change.custom.CustomChange
-
getConfirmationMessage
- Specified by:
getConfirmationMessagein interfaceliquibase.change.custom.CustomChange
-
setUp
public void setUp() throws liquibase.exception.SetupException- Specified by:
setUpin interfaceliquibase.change.custom.CustomChange- Throws:
liquibase.exception.SetupException
-
generateStatements
public liquibase.statement.SqlStatement[] generateStatements(liquibase.database.Database database) throws liquibase.exception.CustomChangeException - Specified by:
generateStatementsin interfaceliquibase.change.custom.CustomSqlChange- Throws:
liquibase.exception.CustomChangeException
-
isApplicable
protected boolean isApplicable() throws liquibase.exception.CustomChangeException- Throws:
liquibase.exception.CustomChangeException
-
hasColumn
protected boolean hasColumn(String tableName, String columnName) throws liquibase.exception.CustomChangeException Checks whether the column exists on the database the task reads from. During manual migration script generation that is the pre-upgrade database, which lacks every table and column added by earlier changesets of the script.- Throws:
liquibase.exception.CustomChangeException
-
hasTable
Checks whether the table exists on the database the task reads from, seehasColumn(String, String).- Throws:
liquibase.exception.CustomChangeException
-
getIdpOrganizationLinks
protected List<CustomKeycloakTask.IdpOrganizationLink> getIdpOrganizationLinks() throws liquibase.exception.CustomChangeExceptionReads the identity provider to organization links of the database the task reads from. Since 26.0.0 they are inIDENTITY_PROVIDER.ORGANIZATION_ID. Before that they are in thekc.orgentry ofIDENTITY_PROVIDER_CONFIG, which is what the pre-upgrade database still holds when a manual migration script is generated from a 25.x starting version: the statements of the 26.0.0 migration are only part of the script.- Throws:
liquibase.exception.CustomChangeException
-
generateStatementsImpl
protected abstract void generateStatementsImpl() throws liquibase.exception.CustomChangeExceptionIt's supposed to fill SQL statements to the "statements" variable and fill "confirmationMessage"- Throws:
liquibase.exception.CustomChangeException
-
getTaskId
-
getTableName
-