Configure Extension with UiPageProvider #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "addUiPageProvider"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tested by following the README and using the compose file and it works great. Generally looks good, just a few small things here and there.
@ -0,0 +8,4 @@- is in the attribute group matching `attribute-group`- matches an optional RegEx Pattern `attribute-regex`- belongs to a user with a role matching `match-role`- is non-emptyShould use plural, like:
@ -0,0 +24,4 @@*/@AutoService(UiPageProviderFactory.class)public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<ComponentModel> {public static final String PROVIDER_ID = "🪪 Attribute Endpoints 🚀";I think getting rid of the emojis, while they are fun, might be a good idea.
@ -0,0 +53,4 @@@GET@Path("export/{slug}")@Produces(MediaType.APPLICATION_JSON)public Response exportKeys(@PathParam("slug") String slug) {I guess this should be called something like
exportAttributeValuesnow that this is not just about SSH Keys anymore.@ -0,0 +106,4 @@throw new ForbiddenException("User does not have required auth role.");}if (componentList.size() > 1) {Moving this before line 71, where we get the component to work with might make a bit more sense flow-wise.
Oh, and we have both a
test.jsonand arealm-export.json. Do we want to keep them both, one or none?Reading through the code, I noticed that we are duplicating the validation logic for the
AdminUiPageand theAttributeEndpointsResourceProvider. I think this is fine, as it's just refactoring and they do both cater to slightly different use-cases, so a refactor needs some thought, but we might want to look into abstracting that into one place in the future.@ -0,0 +55,4 @@Pattern slugPattern = Pattern.compile("^[a-zA-Z0-9_-]*$");String configAttributeSlug = model.getConfig().getFirst("slug");if (!slugPattern.matcher(configAttributeSlug).matches()) {Currently this gives us an ugly exception in the Keycloak logs for an empty slug, as
configAttributeSlugis thennull. Not critical as it still just errors, but we should probably check, ifconfigAttributeSlugisnull. I guess then adding a null check to all the otherconfig$things is probably a good idea as well.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.