-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OIDC SecurityEvent #12198
Add OIDC SecurityEvent #12198
Conversation
5f1e2fb
to
550a522
Compare
Doesn't look good:
|
Oops. I forgot to check |
fc8f4bf
to
1513299
Compare
@sberyozkin I'm wondering if security events support shouldn't rather be provided by the security layer and extended with additional events specific for OIDC ? |
Hi @pedroigor That said I don't really mind creating some base |
15059f7
to
8596f3c
Compare
@sberyozkin I see. What about CDI Event System? Can we leverage that instead of creating our own? |
Hi @pedroigor interesting, let me ask @mkouba, hi Martin, how can one, in the Quarkus extension code, send an event via |
This should be done using Arc. You send them the same way you do normally (i.e. javax.enterprise.inject.spi.BeanManager#fireEvent) |
@sberyozkin @pedroigor Stuart is right, however keep in mind that you can't fire the CDI events until the container is started, i.e. you can't fire events during the build phase and you can fire events during STATIC_INIT bootstrap phase assuming you make sure the container is started, e.g. depend on the For more information about CDI events in general see https://quarkus.io/guides/cdi#events-and-observers and https://docs.jboss.org/weld/reference/latest/en-US/html_single/#events. |
8596f3c
to
578b8e4
Compare
Hi All, @pedroigor @mkouba @stuartwdouglas It works very well, thanks, I've never done CDI events before so missed this neat option completely :-), have a look at the update PR please One question I have here, is, I think it is worth introducing a property like And I suppose a bigger question, Stuart, Pedro, do we want to move this |
578b8e4
to
9ad2aa4
Compare
@mkouba is there an easy way to figure out if an event will have any observers? This should not require a config property but skipping if there are no observers makes sense IMHO. |
@sberyozkin @stuartwdouglas So first of all if |
4e15e67
to
ed81d03
Compare
Hi @mkouba @stuartwdouglas @pedroigor Have a look please at how the observers are checked now. I think it is not bad but can optimize as needed, I had to create a separate build step to avoid the chain issues. I'd like to keep this observer checking code in the OIDC extension for now as we have some concrete requirements about the events there, but we can push it down to the common security code easily as needed, potentially the security events can give a very fine grained view into what is going on within various Quarkus Security flows :-), but integrating it into the rest of Quarkus Security would be a bigger issue which can be done iteratively... The bigger question IMHO is where to keep What do you think ? Thanks |
extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java
Show resolved
Hide resolved
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java
Outdated
Show resolved
Hide resolved
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigBean.java
Outdated
Show resolved
Hide resolved
ed81d03
to
fa6f201
Compare
fa6f201
to
a0f4eac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
OK, so for now this will be an OIDC-centric SecurityEvent but we will migrate to a more common package if ever needed |
Fixes #12145
This PR adds a listener which can capture some important login/session/logout events based on the conversation with the user.
Login
(i.e creating a new session after a successful code flow) is of primary interest, but other events (4 of them for now, more can be added easily) will let users have a better view into what is going on.Note I'm passing a blocking API ref as a context attribute (in case some expensive action will need to be done), @stuartwdouglas, if you prefer, I can have a dedicated parameter.
Also updated the RP-initiated doc section as the user could not make it work (was not obvious the logout path had to be authenticated)