Closed JanUnld closed 3 years ago
Hey Jan,
thanks for contributing β€οΈ.
I skimmed over the pullrequest and maybe we can make it work without having an abstract class. My suggestion would be, that we leave it as separate commands addClientMapper
and addClientScopeMapper
. We can then reuse the functionality of adding a mapper for the second case.
I favor composition over inheritance and I would prefer to have a lot of simple actions that do one thing over complex actions.
Maybe there is something I am missing here why we can't make it work like that or if this doesn't resonate with your style of code at all we could schedule a call for this because code reviews only in texts are always hard in my eyes. Best Regards Lukas
Hey Lukas π thanks for the feedback!
Sounds totally reasonable to me, I would try to adjust my impls accordingly. I definitely want to comply with your design thinking here! So to shortly summarize what I understood and would do out of you feedback:
AddMapperBaseAction
in favor of composition! πAdd*Mapper
actions to AddClient*Mapper
format
Add*Mapper
dependents?!AddClientScope*Mapper
actionsDo we want to consider updateClient*Mapper
and updateClientScope*Mapper
actions as well? π€π
If you prefer we can actually also schedule a call for a "deeper dive" but I just wanted to give you a short response on the abstraction topic. I actually totally agree to you "composition over abstraction" preference, even tho I never actually thought of it that way π. I think we might benefit from a slightly less complex AddProtocolMapperAction
base class here in terms of "maintainability". The key point is that we wouldn't need to implement the "same" subsequent Action.execute
and Action.undo
functions for each individual mapper action type, even tho you could. Anyways, if you prefer to not do that, than that's totally fine for me π, might just take some more effort π.
Thanks again for the response!
Best regards Jan
Thanks for the feedback. :) I think this all sounds reasonable.
I would like to leave addMapper
and deleteMapper
in the ActionFactory
as long as we don't have a migration path for them and this is definitely out of scope. But we should remove them from the docs and only mention addClientMapper
, deleteClientMapper
in the documentation.
I don't need the update-Mapper commands right now because you can always delete and recreate them without loosing any data but if you wish you can surely implement them. Thanks for the work you put into it β€οΈ most times I just get issues of things i better immediately implement :D Best Regards Lukas
Hey Lukas π π so I did the changes we discussed and updated the doc contents and tests accordingly. Let me know if there's anything else I can do! Happy reviewing π
I also added a few @Deprecated
annotations, just tell me if we want them a bit more comprehensive regardnig the replaceWith
expressions.
Looks all good so far for me :) a minor type in the docs.
If you want you could do a full integration test with the yamls files. Therefore is the test changelog located at: /src/test/resources/keycloak-changelog.yaml
and the corresponding files in /src/test/resources/changesets/
. You can than execute these migrations against the test keycloak instance started by the startLocalKeycloak
gradle task running on http://localhost:18080
.
So you can be sure that all your actions serialize correctly.
If you are already dead sure we can skip this part :)
Happy to hear that π! I fixed the typos in scope.md
and also added/adjusted the integration tests for the client and client scope mappers. Unfortunately I'm not able to verify my integration tests at this very moment. Got a weird...
java.lang.NoSuchMethodError: java.nio.file.Files.readString
...exception when running the TestChangesets.kt
test file π€·. Probably some sdk related thing, anyways I definitely ran all of the related unit tests, so the action impls for sure work π! I also double checked the ActionFactory
definitions and am also pretty sure that the mappings are there.
I compile the code with openjdk version 11: https://jdk.java.net/archive/. I will checkout your pr and try it locally :)
Thanks for trying out the integration tests on your end π! I've updated the changesets accordingly.
Ok last thing todo is to merge the current master into your pull request as i am not able to do that :) there should be "command line instructions" at the bottom of this pull request
Done βοΈ
Merged I'll inform you as soon as I released it :)
Thank you! π
Hey, first of all thanks for the work you already put into this tool πβ€οΈ. It totally catched my attention after a collegue shared it with me. I immediatly tried it out and it turned out to work very well for us. During the integration refactoring I'm currently progressing with we also stumbeled across an additional feature the community might benefit from:
ProtocolMapper Actions for ClientScopes
Anyways, I tried to use some free time to put this PR together. To summarize what's included:
KeycloakClient
extension + refactoring (distinction between client and client scope mappers)abstract class AddMapperActionBase
with support forclientId
as well asclientScopeName
relationAddMapper
relatedAction
impl to use the new abstract base classI'm totally new to Kotlin and Java, it's actually the first time I touched Kotlin at all, but it honestly was a breeze. If there's anything I can further contribute or if the PR is totally "of the board", let me know π
Cheers βοΈ