Skip to main content

Vertx 3 and Keycloak tutorial

With the upcoming release of Vert.x 3.3 securing your application with Keycloak is even easier than before.

About Keycloak

Keycloak describes itself as an Open Source Identity and Access Management For Modern Applications and Services.

With Keycloak you can quickly add Authentication and Authorization to your vert.x application. The easy way is to setup a realm on keycloak and once you’re done, export the configuration to your vert.x app.

This how you would secure your app:

  1. create a OAuth2Auth instance with OAuth2Auth.createKeycloak(...)
  2. copy your config from the keycloak admin GUI
  3. setup your callback according to what you entered on keycloak
  4. secure your resource with router.route("/protected/*").handler(oauth2)

Screencast

The following screencast explains how you can do this from scratch:

Don’t forget to follow our youtube channel!