KEYCLOAK-18617 Fix index on client attributes
This commit is contained in:
parent
5d9d749fbd
commit
2acb43a627
5 changed files with 91 additions and 7 deletions
|
@ -38,12 +38,7 @@
|
||||||
|
|
||||||
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286">
|
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286">
|
||||||
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
||||||
<not>
|
<changeSetExecuted id="NONEXISTENT" author="NONEXISTENT" changeLogFile="NONEXISTENT" /> <!-- Effectively disable this changeset -->
|
||||||
<or>
|
|
||||||
<dbms type="mysql"/>
|
|
||||||
<dbms type="mariadb"/>
|
|
||||||
</or>
|
|
||||||
</not>
|
|
||||||
</preConditions>
|
</preConditions>
|
||||||
<createIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE">
|
<createIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE">
|
||||||
<column name="NAME" type="VARCHAR(255)"/>
|
<column name="NAME" type="VARCHAR(255)"/>
|
||||||
|
@ -51,17 +46,53 @@
|
||||||
</createIndex>
|
</createIndex>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286-mysql">
|
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286-revert">
|
||||||
|
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
||||||
|
<indexExists tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE" />
|
||||||
|
<or>
|
||||||
|
<changeSetExecuted id="14.0.0-KEYCLOAK-18286" author="keycloak" changeLogFile="META-INF/jpa-changelog-14.0.0.xml" />
|
||||||
|
<changeSetExecuted id="14.0.0-KEYCLOAK-18286-mysql" author="keycloak" changeLogFile="META-INF/jpa-changelog-14.0.0.xml" />
|
||||||
|
</or>
|
||||||
|
</preConditions>
|
||||||
|
<dropIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286-supported-dbs">
|
||||||
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
||||||
<or>
|
<or>
|
||||||
<dbms type="mysql"/>
|
<dbms type="mysql"/>
|
||||||
<dbms type="mariadb"/>
|
<dbms type="mariadb"/>
|
||||||
|
<dbms type="postgresql"/>
|
||||||
|
<dbms type="oracle"/>
|
||||||
</or>
|
</or>
|
||||||
</preConditions>
|
</preConditions>
|
||||||
<createIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE">
|
<createIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE">
|
||||||
<column name="NAME" type="VARCHAR(255)"/>
|
<column name="NAME" type="VARCHAR(255)"/>
|
||||||
<column name="VALUE(255)" valueComputed="VALUE(255)" />
|
<column name="VALUE(255)" valueComputed="VALUE(255)" />
|
||||||
</createIndex>
|
</createIndex>
|
||||||
|
<modifySql dbms="postgresql">
|
||||||
|
<replace replace="VALUE(255)" with="(value::varchar(250))" />
|
||||||
|
</modifySql>
|
||||||
|
<modifySql dbms="oracle">
|
||||||
|
<replace replace="VALUE(255)" with="SUBSTR(VALUE, 1, 250)" />
|
||||||
|
</modifySql>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet author="keycloak" id="14.0.0-KEYCLOAK-18286-unsupported-dbs">
|
||||||
|
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<or>
|
||||||
|
<dbms type="mysql"/>
|
||||||
|
<dbms type="mariadb"/>
|
||||||
|
<dbms type="postgresql"/>
|
||||||
|
<dbms type="oracle"/>
|
||||||
|
</or>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
<createIndex tableName="CLIENT_ATTRIBUTES" indexName="IDX_CLIENT_ATT_BY_NAME_VALUE">
|
||||||
|
<column name="NAME" type="VARCHAR(255)"/>
|
||||||
|
<!-- Do not include VALUE column -->
|
||||||
|
</createIndex>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet author="keycloak" id="KEYCLOAK-17267-add-index-to-user-attributes">
|
<changeSet author="keycloak" id="KEYCLOAK-17267-add-index-to-user-attributes">
|
||||||
|
|
|
@ -981,6 +981,55 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void testExtremelyLongClientAttribute(RealmResource realm) {
|
||||||
|
log.info("Testing SAML certfificates attribute");
|
||||||
|
|
||||||
|
realm.clients().findByClientId("migration-saml-client")
|
||||||
|
.forEach(clientRepresentation -> {
|
||||||
|
assertThat(clientRepresentation.getAttributes(), hasEntry("extremely_long_attribute",
|
||||||
|
" 00000 00010 00020 00030 00040 00050 00060 00070 00080 00090"
|
||||||
|
+ " 00100 00110 00120 00130 00140 00150 00160 00170 00180 00190"
|
||||||
|
+ " 00200 00210 00220 00230 00240 00250 00260 00270 00280 00290"
|
||||||
|
+ " 00300 00310 00320 00330 00340 00350 00360 00370 00380 00390"
|
||||||
|
+ " 00400 00410 00420 00430 00440 00450 00460 00470 00480 00490"
|
||||||
|
+ " 00500 00510 00520 00530 00540 00550 00560 00570 00580 00590"
|
||||||
|
+ " 00600 00610 00620 00630 00640 00650 00660 00670 00680 00690"
|
||||||
|
+ " 00700 00710 00720 00730 00740 00750 00760 00770 00780 00790"
|
||||||
|
+ " 00800 00810 00820 00830 00840 00850 00860 00870 00880 00890"
|
||||||
|
+ " 00900 00910 00920 00930 00940 00950 00960 00970 00980 00990"
|
||||||
|
+ " 01000 01010 01020 01030 01040 01050 01060 01070 01080 01090"
|
||||||
|
+ " 01100 01110 01120 01130 01140 01150 01160 01170 01180 01190"
|
||||||
|
+ " 01200 01210 01220 01230 01240 01250 01260 01270 01280 01290"
|
||||||
|
+ " 01300 01310 01320 01330 01340 01350 01360 01370 01380 01390"
|
||||||
|
+ " 01400 01410 01420 01430 01440 01450 01460 01470 01480 01490"
|
||||||
|
+ " 01500 01510 01520 01530 01540 01550 01560 01570 01580 01590"
|
||||||
|
+ " 01600 01610 01620 01630 01640 01650 01660 01670 01680 01690"
|
||||||
|
+ " 01700 01710 01720 01730 01740 01750 01760 01770 01780 01790"
|
||||||
|
+ " 01800 01810 01820 01830 01840 01850 01860 01870 01880 01890"
|
||||||
|
+ " 01900 01910 01920 01930 01940 01950 01960 01970 01980 01990"
|
||||||
|
+ " 02000 02010 02020 02030 02040 02050 02060 02070 02080 02090"
|
||||||
|
+ " 02100 02110 02120 02130 02140 02150 02160 02170 02180 02190"
|
||||||
|
+ " 02200 02210 02220 02230 02240 02250 02260 02270 02280 02290"
|
||||||
|
+ " 02300 02310 02320 02330 02340 02350 02360 02370 02380 02390"
|
||||||
|
+ " 02400 02410 02420 02430 02440 02450 02460 02470 02480 02490"
|
||||||
|
+ " 02500 02510 02520 02530 02540 02550 02560 02570 02580 02590"
|
||||||
|
+ " 02600 02610 02620 02630 02640 02650 02660 02670 02680 02690"
|
||||||
|
+ " 02700 02710 02720 02730 02740 02750 02760 02770 02780 02790"
|
||||||
|
+ " 02800 02810 02820 02830 02840 02850 02860 02870 02880 02890"
|
||||||
|
+ " 02900 02910 02920 02930 02940 02950 02960 02970 02980 02990"
|
||||||
|
+ " 03000 03010 03020 03030 03040 03050 03060 03070 03080 03090"
|
||||||
|
+ " 03100 03110 03120 03130 03140 03150 03160 03170 03180 03190"
|
||||||
|
+ " 03200 03210 03220 03230 03240 03250 03260 03270 03280 03290"
|
||||||
|
+ " 03300 03310 03320 03330 03340 03350 03360 03370 03380 03390"
|
||||||
|
+ " 03400 03410 03420 03430 03440 03450 03460 03470 03480 03490"
|
||||||
|
+ " 03500 03510 03520 03530 03540 03550 03560 03570 03580 03590"
|
||||||
|
+ " 03600 03610 03620 03630 03640 03650 03660 03670 03680 03690"
|
||||||
|
+ " 03700 03710 03720 03730 03740 03750 03760 03770 03780 03790"
|
||||||
|
+ " 03800 03810 03820 03830 03840 03850 03860 03870 03880 03890"
|
||||||
|
+ " 03900 03910 03920 03930 03940 03950 03960 03970 03980"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected void testRealmAttributesMigration() {
|
protected void testRealmAttributesMigration() {
|
||||||
log.info("testing realm attributes migration");
|
log.info("testing realm attributes migration");
|
||||||
Map<String, String> realmAttributes = migrationRealm.toRepresentation().getAttributes();
|
Map<String, String> realmAttributes = migrationRealm.toRepresentation().getAttributes();
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class MigrationTest extends AbstractMigrationTest {
|
||||||
|
|
||||||
// Always test offline-token login during migration test
|
// Always test offline-token login during migration test
|
||||||
testOfflineTokenLogin();
|
testOfflineTokenLogin();
|
||||||
|
testExtremelyLongClientAttribute(migrationRealm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -82,6 +83,7 @@ public class MigrationTest extends AbstractMigrationTest {
|
||||||
|
|
||||||
// Always test offline-token login during migration test
|
// Always test offline-token login during migration test
|
||||||
testOfflineTokenLogin();
|
testOfflineTokenLogin();
|
||||||
|
testExtremelyLongClientAttribute(migrationRealm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -541,6 +541,7 @@
|
||||||
"saml_assertion_consumer_url_post": "http://localhost:8080/sales-post/saml",
|
"saml_assertion_consumer_url_post": "http://localhost:8080/sales-post/saml",
|
||||||
"saml_single_logout_service_url_post": "http://localhost:8080/sales-post/saml",
|
"saml_single_logout_service_url_post": "http://localhost:8080/sales-post/saml",
|
||||||
"saml.authnstatement": "true",
|
"saml.authnstatement": "true",
|
||||||
|
"extremely_long_attribute": " 00000 00010 00020 00030 00040 00050 00060 00070 00080 00090 00100 00110 00120 00130 00140 00150 00160 00170 00180 00190 00200 00210 00220 00230 00240 00250 00260 00270 00280 00290 00300 00310 00320 00330 00340 00350 00360 00370 00380 00390 00400 00410 00420 00430 00440 00450 00460 00470 00480 00490 00500 00510 00520 00530 00540 00550 00560 00570 00580 00590 00600 00610 00620 00630 00640 00650 00660 00670 00680 00690 00700 00710 00720 00730 00740 00750 00760 00770 00780 00790 00800 00810 00820 00830 00840 00850 00860 00870 00880 00890 00900 00910 00920 00930 00940 00950 00960 00970 00980 00990 01000 01010 01020 01030 01040 01050 01060 01070 01080 01090 01100 01110 01120 01130 01140 01150 01160 01170 01180 01190 01200 01210 01220 01230 01240 01250 01260 01270 01280 01290 01300 01310 01320 01330 01340 01350 01360 01370 01380 01390 01400 01410 01420 01430 01440 01450 01460 01470 01480 01490 01500 01510 01520 01530 01540 01550 01560 01570 01580 01590 01600 01610 01620 01630 01640 01650 01660 01670 01680 01690 01700 01710 01720 01730 01740 01750 01760 01770 01780 01790 01800 01810 01820 01830 01840 01850 01860 01870 01880 01890 01900 01910 01920 01930 01940 01950 01960 01970 01980 01990 02000 02010 02020 02030 02040 02050 02060 02070 02080 02090 02100 02110 02120 02130 02140 02150 02160 02170 02180 02190 02200 02210 02220 02230 02240 02250 02260 02270 02280 02290 02300 02310 02320 02330 02340 02350 02360 02370 02380 02390 02400 02410 02420 02430 02440 02450 02460 02470 02480 02490 02500 02510 02520 02530 02540 02550 02560 02570 02580 02590 02600 02610 02620 02630 02640 02650 02660 02670 02680 02690 02700 02710 02720 02730 02740 02750 02760 02770 02780 02790 02800 02810 02820 02830 02840 02850 02860 02870 02880 02890 02900 02910 02920 02930 02940 02950 02960 02970 02980 02990 03000 03010 03020 03030 03040 03050 03060 03070 03080 03090 03100 03110 03120 03130 03140 03150 03160 03170 03180 03190 03200 03210 03220 03230 03240 03250 03260 03270 03280 03290 03300 03310 03320 03330 03340 03350 03360 03370 03380 03390 03400 03410 03420 03430 03440 03450 03460 03470 03480 03490 03500 03510 03520 03530 03540 03550 03560 03570 03580 03590 03600 03610 03620 03630 03640 03650 03660 03670 03680 03690 03700 03710 03720 03730 03740 03750 03760 03770 03780 03790 03800 03810 03820 03830 03840 03850 03860 03870 03880 03890 03900 03910 03920 03930 03940 03950 03960 03970 03980",
|
||||||
"saml_idp_initiated_sso_url_name": "sales-post"
|
"saml_idp_initiated_sso_url_name": "sales-post"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -566,6 +566,7 @@
|
||||||
"saml_assertion_consumer_url_post": "http://localhost:8080/sales-post/saml",
|
"saml_assertion_consumer_url_post": "http://localhost:8080/sales-post/saml",
|
||||||
"saml_single_logout_service_url_post": "http://localhost:8080/sales-post/saml",
|
"saml_single_logout_service_url_post": "http://localhost:8080/sales-post/saml",
|
||||||
"saml.authnstatement": "true",
|
"saml.authnstatement": "true",
|
||||||
|
"extremely_long_attribute": " 00000 00010 00020 00030 00040 00050 00060 00070 00080 00090 00100 00110 00120 00130 00140 00150 00160 00170 00180 00190 00200 00210 00220 00230 00240 00250 00260 00270 00280 00290 00300 00310 00320 00330 00340 00350 00360 00370 00380 00390 00400 00410 00420 00430 00440 00450 00460 00470 00480 00490 00500 00510 00520 00530 00540 00550 00560 00570 00580 00590 00600 00610 00620 00630 00640 00650 00660 00670 00680 00690 00700 00710 00720 00730 00740 00750 00760 00770 00780 00790 00800 00810 00820 00830 00840 00850 00860 00870 00880 00890 00900 00910 00920 00930 00940 00950 00960 00970 00980 00990 01000 01010 01020 01030 01040 01050 01060 01070 01080 01090 01100 01110 01120 01130 01140 01150 01160 01170 01180 01190 01200 01210 01220 01230 01240 01250 01260 01270 01280 01290 01300 01310 01320 01330 01340 01350 01360 01370 01380 01390 01400 01410 01420 01430 01440 01450 01460 01470 01480 01490 01500 01510 01520 01530 01540 01550 01560 01570 01580 01590 01600 01610 01620 01630 01640 01650 01660 01670 01680 01690 01700 01710 01720 01730 01740 01750 01760 01770 01780 01790 01800 01810 01820 01830 01840 01850 01860 01870 01880 01890 01900 01910 01920 01930 01940 01950 01960 01970 01980 01990 02000 02010 02020 02030 02040 02050 02060 02070 02080 02090 02100 02110 02120 02130 02140 02150 02160 02170 02180 02190 02200 02210 02220 02230 02240 02250 02260 02270 02280 02290 02300 02310 02320 02330 02340 02350 02360 02370 02380 02390 02400 02410 02420 02430 02440 02450 02460 02470 02480 02490 02500 02510 02520 02530 02540 02550 02560 02570 02580 02590 02600 02610 02620 02630 02640 02650 02660 02670 02680 02690 02700 02710 02720 02730 02740 02750 02760 02770 02780 02790 02800 02810 02820 02830 02840 02850 02860 02870 02880 02890 02900 02910 02920 02930 02940 02950 02960 02970 02980 02990 03000 03010 03020 03030 03040 03050 03060 03070 03080 03090 03100 03110 03120 03130 03140 03150 03160 03170 03180 03190 03200 03210 03220 03230 03240 03250 03260 03270 03280 03290 03300 03310 03320 03330 03340 03350 03360 03370 03380 03390 03400 03410 03420 03430 03440 03450 03460 03470 03480 03490 03500 03510 03520 03530 03540 03550 03560 03570 03580 03590 03600 03610 03620 03630 03640 03650 03660 03670 03680 03690 03700 03710 03720 03730 03740 03750 03760 03770 03780 03790 03800 03810 03820 03830 03840 03850 03860 03870 03880 03890 03900 03910 03920 03930 03940 03950 03960 03970 03980",
|
||||||
"saml_idp_initiated_sso_url_name": "sales-post"
|
"saml_idp_initiated_sso_url_name": "sales-post"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
|
|
Loading…
Reference in a new issue