Repository navigation
Conversation
|
Hi, May I just got confused by the sentence "User removes an authenticator" which would be the account API right? Are you planning to support also other user representations than idm.UserRepresentation like account.UserRepresentation, and what will the format for the CloudEvent be? How does the consumer know which type he will get? Will there be a harmonization of the types within the event spi. If yes can the harmonized objects used against account and admin api? |
|
@bs-matil Thank you for your feedback!
That's exactly the point. :) To build a new event logic tailored for user use cases.
Correct.
Good point with the various representations. Maybe we could introduce a UserRepresentation just for the User Event SPI. |
|
Yes that could be an idea. But still you would than have "the next" representation. e.g. I have no clear idea how this could look like. Just a very first thought on this. |
|
I like the API but I'm wondering if we could make it more generic. I don't think we should care about the different representations and an event should just hold any set of key/value pairs with contextual data so that listeners can do whatever they want with it. I mean do they need to be strongly typed? Probably versioned. I also think that the Event API you are proposing is what could help us in other areas too such as Validation (not only for users) in both User Profile, Client, etc. I mentioned that when reviewing #7155 (comment). I'm afraid we are adding too many things that are somewhat related at their core and that may cause some headaches in the future. For instance, in User Profile, there are "events" for users, what we should do about it? There are so many things we can do with a well designed and general-purpose Event API ... |
|
@pedroigor Thanks for the feedback! From the discussions with @stianst I believe the focus here was meant to be really narrow – an SPI tailored only for user events. I think a loosely typed key-value object map would be an option too, although I personally don't like this solution too much as I find it unnecessarily hard for the developer to use – keys, casting, ...
Yes, that could be a problem. On the other hand, that's why this is a prototype, I'm ready for some refactoring. :) |
Yeah, true. But I was thinking something like this: That format looks simple and easy to follow/consume, so that you have the event type, the attributes that were created/modified and their values in a separate place. So, something around that where we only need to define the event types and keep data in an easy to consume (and automatize) format.
Yeah and a nice prototype. Another thing to consider here too is that in the future we might start supporting CDI (Quarkus) and there we already have CDI Events. |
@pedroigor Yes, sure, makes sense to me. But this representation is something to be used in the external interface, e.g. CloudEvents, right? I.e. it is up to each event listener how they "translate" the representation.
@pedroigor I believe this will be covered in KEYCLOAK-15456. ;) I've rebased the changes to remove conflicts. |
It is, and the nice thing about that format is that you have the attributes that are part of the event and their values separated. So one could easily "translate" the event by initially looking at the attributes that were set as well as the type of the event. So, in the end, what is important is to check the event type and the metadata associated with it. With the possibility to have multiple event types within the same event (if that would be useful for certain scenarios). We would then provide a generic API on top of that format where only the event type is strongly typed, for both marshaling and unmarshalling events. It would be the same format for both internal and external listeners.
|
| } | ||
|
|
||
| try { | ||
| UserEventContext userEvent = UserEvents.createByAdmin(session, rep).firePreEvent(); |
There was a problem hiding this comment.
Should this really be fired in the Ressource. Should not this be implemented in the UserStorageProvider or UserStorageManager?
I am just wondering because there may be use cases where creation or deletion of a user may not be triggered by an API. For example, UserStorageManager has a feature 'import validation' which deletes users from Keycloak when they are invalid or do not exist any longern in the system integrated by the federation provider.
|
Haven't read the PR yet, but had a look at the design proposal again, and a few comments to that:
This kinda suggests to me that first round here should be focused on the "low-level" SPIm, which is the equivalent of our current SPIs, then we'd need to work an a design proposal for higher-level Java APIs (do we also want JavaScript in-process in the future!?!), as well as a design proposal for external providers. |
|
@stianst Thanks for your comments.
Sure, but wouldn't be JWT more secure than sending the secret (that can be later used for approving/rejecting) in each event? But yes, that could be an option.
Yes, I even think we discussed it somewhere. But I think this might even deserve a separate design doc. Maybe this (registering external providers) could be a bit independent/separated from the User Event SPI.
That's something to investigate but I'd stick with CloudEvents as a default option for now.
Yes, we discussed this previously too. It's currently a Phase 4 of my prototype. ;)
Sure, that's the plan. :) See KEYCLOAK-15449. |
|
This is only done for users. In order to add cloud actions for e.g. SCIM it would be necessary to have these actions also for other resources like groups. |
|
AFAIK the approach for improving user events experience is a little bit something else than introduced in this PR. WDYT @velias ? |
|
@vmuzikar yep, I agree this this is something a little bit different, I'd say calling it "user event SPI" is misleading a bit, I'd call it something like 'user approval SPI' or 'user workflow SPI'. BTW 1 - UserProfile provider has been introduced in meantime, it centralizes actions around user (creation, update), maybe this functionality should be integrated into it rather than into action classes (but this may clash with the next BTW 2 ;-) BTW 2 - current implementation looks to be fully synchronous, blocking requests from browser, so it expects handling of approval actions is fast enough. I do not know requirements for this feature, but have you though about more asynchronous mechanism (which would be more complex to implement for sure)? |
|
Closing this for now and opened a discussion on this topic here: |
Based on design proposal.