[keycloak-user] Keycloak Even when user is authenticated

Thomas Darimont thomas.darimont at googlemail.com
Fri Dec 2 05:45:36 EST 2016


Hello,

I wrote a Keycloak JMS event forwarder extension a while ago that does this.

It sends JMS text messages for various keycloak events in json format that
look like this:

{
  "eventId" : "0f97dcaf-f682-44c4-9165-3ba79f05b0e2",
  "instanceName" : "23496 at tom:192.168.99.1",
  "realmId" : "acme-dev-local",
  "userId" : "a9c18800-1289-4ffb-9621-35af0eb7cd8a",
  "type" : "USER",
  "timestamp" : 1480675080396,
  "contextId" : "USER",
  "contextAction" : "LOGIN",
  "contextData" : { },
  "auditInfo" : { //who did the action? (if user did it himself same as
userInfo)
    "realmId" : "acme-dev-local",
    "clientId" : "account",
    "ipAddress" : "192.168.99.1",
    "userId" : "a9c18800-1289-4ffb-9621-35af0eb7cd8a",
    "username" : "tom"
  },
  "userInfo" : { // info of the user involved
    "userId" : "a9c18800-1289-4ffb-9621-35af0eb7cd8a",
    "realmId" : "acme-dev-local",
    "emailVerified" : false,
    "enabled" : true,
    "username" : "tom",
    "email" : "tom at localhost",
    "firstname" : "Thomas Richard",
    "lastname" : "Darimont",
    "creationDateTime" : 1470147844598,
    "attributes" : {
      "locale" : [ "de" ]
    }
  }
}

One can enable in the events configuration in the admin console once the
extension is configured in keycloak.

You can find on older version of the extension here:
https://github.com/jugsaar/visit-yajug-20161023-keycloak

You can find more information about how to configure custom SPI extensions
here:
https://keycloak.gitbooks.io/server-developer-guide/content/v/2.4/topics/providers.html

Cheers,
Thomas

2016-12-02 8:57 GMT+01:00 Sebastien Blanc <sblanc at redhat.com>:

> AFAIK there is nothing out of the box in the adapter for that but here some
> ideas :
>
> - You could write your custom Event Listener on the KC side that sends :
>    * a rest request to your application, (like a github hook)
>    * publish on a JMS queue
> You can take a look at the documentation/examples on how to implement the
> event SPI.
>
> For the WF Adapter, I think it would be nice if it could publish some CDI
> events, I will open a ticket for that.
>
>
>
> On Thu, Dec 1, 2016 at 9:44 PM, Mario Peck <mariopeck41 at gmail.com> wrote:
>
> > I am working on a web application (war) that uses keycloak for
> > authentication/roles.
> > The application is running on Wildfly 10. Using the wildfly keycloak
> > adapter.
> > I need to listen/detect when a user is authenticated by keycloak. There
> is
> > some work the application must perform when a user is logged in for the
> > first time.
> > Is there some event (Observable message) , or some type of listener that
> I
> > can register to get notified of this? (when a user is authenticated).
> > Thanks to any tips/help
> > Mario
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
> >
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list