HI All .
I have several Vaadin web apps, which successfully integrated with Keycloak OAuth2 provider.
But when I try secure /protected/page OAuth2 handler browser report too many redirects error after providing login and password on keyloak page. It happens because Authorization header not set, checks located here AuthorizationAuthHandler#parseAuthorization.
Is this a bug in OAuth2AuthHandlerImpl or I miss something?
Vertx version 3.5.1, keycloak 3.4
HttpServer server = vertx.createHttpServer();
Router mainRouter = Router.router(vertx);
mainRouter.route().handler(CookieHandler.create());
SessionStore store = ClusteredSessionStore.create(vertx);
SessionHandler sessionHandler = SessionHandler.create(store);
mainRouter.route().handler(sessionHandler);
JsonObject keycloakJson = new JsonObject()
.put("realm", "plumbum")
.put("realm-public-key", "MIIBIjANBgkqhkiG9w0B....skipped")
.put("auth-server-url", "http://localhost:8080/auth")
.put("ssl-required", "external")
.put("resource", "oxy-platform")
.put("credentials",
new JsonObject().put("secret", "8a0b19ee-86c2-4fcc-a912-df09523da19f"));
OAuth2Auth oAuth2 = KeycloakAuth.create(vertx, OAuth2FlowType.AUTH_CODE, keycloakJson);
OAuth2AuthHandler oAuth2AuthHandler = OAuth2AuthHandler.create( oAuth2,"http://localhost:28080");
oAuth2AuthHandler.setupCallback(mainRouter.get("/whatever"));
oAuth2AuthHandler.addAuthority("user:email");
mainRouter.route().handler(UserSessionHandler.create(oAuth2));
mainRouter.route("/protected/page").handler(oAuth2AuthHandler);
mainRouter.route("/protected/page").handler(rc -> {
rc.response().end("Oops ... You never see me. Even with right credentials ");
});
mainRouter.route("/*").handler(StaticHandler.create());
server.requestHandler( mainRouter::accept ).listen(port, host);
Cheers, Igor