8000 MapUserProvider in KC20 needs to store username compatible with KC19 … by vramik · Pull Request #14748 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

MapUserProvider in KC20 needs to store username compatible with KC19 … - #14748

Merged
hmlnarik merged 1 commit into
keycloak:mainfrom
vramik:14678-username-fix
Oct 14, 2022
Merged

hmlnarik merged 1 commit into
keycloak:mainfrom
vramik:14678-username-fix

Conversation

@vramik
@vramik vramik commented Oct 5, 2022
Copy link
Copy Markdown
Contributor

…to be no-downtime-upgradable

Closes #14678

@vramik
vramik force-pushed the 14678-username-fix branch 2 times, most recently from 0edb772 to 88f83c4 Compare October 6, 2022 17:38
@vramik
vramik marked this pull request as ready for review October 7, 2022 07:46
@vramik vramik added area/storage Storage layer — JPA entities, database schemas, Liquibase migrations, caching team/storage-sig labels Oct 7, 2022
@vramik
vramik requested a review from ahus1 October 7, 2022 07:47
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work with entityversion 1?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work now when the migration of the entity was fixed in the last force-push. Each entity loaded from the database should have the usernameWithCase field filled. Or am I missing something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration fixed the functional part when the username is loaded from JSON, thank you.
Will the V1 have the this.usenameWithCase field filled when loading the value from column directly in the next line?

@vramik vramik Oct 7, 2022 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, it won't. I'll add fallback to username field in case of usernameWithCase is null.

@vramik
vramik force-pushed the 14678-username-fix branch from 88f83c4 to 52f7437 Compare October 7, 2022 08:23
@ahus1 ahus1 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new behavior that when the realm attribute is set to false, the username is returned in a case-insensitive format. I believe some of the tests need to be reverted to reflect that. Please see more comments below.

@vramik
vramik force-pushed the 14678-username-fix branch 2 times, most recently from 9933de3 to fd35a44 Compare October 12, 2022 08:36
@vramik
vramik force-pushed the 14678-username-fix branch from fd35a44 to 0775183 Compare October 12, 2022 13:06
@vramik
vramik requested a review from ahus1 October 12, 2022 15:27
@ahus1 ahus1 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the changes and tests them with Keycloak 19.0.3 and this version running against the same database using JPA map storage. I tested it with different scenarios where both write their entity version to the DB, and it works fine. Thank you for preparing this change!

@hmlnarik hmlnarik left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@hmlnarik
hmlnarik merged commit f49582c into keycloak:main Oct 14, 2022
@vramik
vramik deleted the 14678-username-fix branch October 14, 2022 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/storage Storage layer — JPA entities, database schemas, Liquibase migrations, caching

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MapUserProvider in KC20 needs to store username compatible with KC19 to be no-downtime-upgradable

3 participants

0