Hello Mohammad!
These are the configuration items I use for integrating OpenID Connect with a Keycloak or Red Hat SSO server:
JsonObject keycloakJson = new JsonObject()
.put("realm", siteConfig.getAuthRealm())
.put("resource", siteConfig.getAuthResource())
.put("auth-server-url", siteConfig.getAuthUrl())
.put("ssl-required", siteConfig.getAuthSslRequired())
.put("credentials", new JsonObject().put("secret", siteConfig.getAuthSecret()))
;
You can find this configuration here in my open source project:
* I configure a client "
computate.org" in that realm as the "resource" in the configuration:
* The "credentials" "secret" is defined here in Red Hat SSO:
I integrate with Keycloak and Red Hat SSO similarly and perform a
successful logout without a call to AccessTokenImpl.logout. The user
needs to visit a link to the keycloak server's openid-connect/logout
request for the realm, with the redirect_url that will log them out of
keycloak, as described here:
I make the logout URL on the web page link be this:
String o = siteConfig.getAuthUrl()
+ "/realms/"
+ siteConfig.getAuthRealm()
+ "/protocol/openid-connect/logout?redirect_uri="
+ URLEncoder.encode(siteConfig.getSiteBaseUrl() + "/logout", "UTF-8");
You can find this here in my open source project:
Then
you need to configure a logout route in your Vert.x application to get
the session, destroy the session and clear the user, then reroute
somewhere.
router.get("/logout").handler(rc -> {
Session session = rc.session();
if (session != null) {
session.destroy();
}
rc.clearUser();
rc.reroute("/school");
});
You can see my whole configureOpenApi Promise method here where Red Hat SSO integration is configured:
Then
you need to configure your Red Hat SSO client to have the right redirect
URLs for logout, you can figure the URLs here for both development up to
production if they use the same Keycloak server, like I do here:

You would also setup a callback route as well here, that part is important too:
You setup an authProvider, setup cookies, setup sessions, create the OAUTH2AuthHandler with a valid callback URL and callback method that does nothing like below:
OAuth2Auth authProvider = KeycloakAuth.create(vertx, OAuth2FlowType.AUTH_CODE, keycloakJson);
router.route().handler(new CookieHandlerImpl());
LocalSessionStore sessionStore = LocalSessionStore.create(vertx);
SessionHandler sessionHandler = SessionHandler.create(sessionStore);
sessionHandler.setAuthProvider(authProvider);
router.route().handler(sessionHandler);
String siteUrlBase = siteConfig.getSiteBaseUrl();
OAuth2AuthHandler authHandler = OAuth2AuthHandler.create(authProvider, siteUrlBase + "/callback");
authHandler.setupCallback(router.get("/callback"));
Hopefully that gets you started :)
Courage!
Christopher Tate