You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of Client v2 created in #43167 leverages the original v1 API logic. This drastically limits the capabilities of v2 in terms of defaulting, validations, pagination, querying etc.
For v2 we need a dedicated service layer that will be built directly on top of the model layer, without the dependency on v1.
Goals
Remove the dependency on v1 from v2.
Create a dedicated service layer for v2 with corresponding behaviour to when v1 was used as the backend (i.e validations, eventing, auth, etc.).
Non-Goals
Add new features (pagination, querying, etc.) to v2.
We could potentially revamp everything in Keycloak around using only interfaces together with some custom FasterXML serializer/deserializer and some Java proxies to get rid of all boilerplate code around model-to-representation and visa versa.
We could also allow code to operate on the actual interfaces rather than using attributes. For example it could look something like this:
Main point here is that MyCustomProtocolMapperRepresentation is just an interface, it's not an implementation. That's handled through proxies.
We have quite a lot of hacky boilerplate code not just in model-to-representation, but take identity providers for instance, and other places, where we can implementations that manually call getAttributes, etc.
Let's figure out a proper way of defining contracts both for APIs and internally that uses interfaces only with some annotations. I know this is a big ask, but we can figure out a way to do this in stages.
Another aspect here is we currently have custom components etc. that uses PropertyConfig or whatever; it would be nice if we get rid of this as well, and rather than creating a list of PropertyConfig you just define the config as a representation interface with some annotations. That means we can use the same interface in OpenAPI specs, and validation without having to check values manually in the code.
Activity
stianst commentedon Nov 19, 2025
We could potentially revamp everything in Keycloak around using only interfaces together with some custom FasterXML serializer/deserializer and some Java proxies to get rid of all boilerplate code around model-to-representation and visa versa.
We could also allow code to operate on the actual interfaces rather than using attributes. For example it could look something like this:
Main point here is that MyCustomProtocolMapperRepresentation is just an interface, it's not an implementation. That's handled through proxies.
We have quite a lot of hacky boilerplate code not just in model-to-representation, but take identity providers for instance, and other places, where we can implementations that manually call getAttributes, etc.
Let's figure out a proper way of defining contracts both for APIs and internally that uses interfaces only with some annotations. I know this is a big ask, but we can figure out a way to do this in stages.
Another aspect here is we currently have custom components etc. that uses PropertyConfig or whatever; it would be nice if we get rid of this as well, and rather than creating a list of PropertyConfig you just define the config as a representation interface with some annotations. That means we can use the same interface in OpenAPI specs, and validation without having to check values manually in the code.
28 remaining items