Vertx HTTP + web Proxy + Oauth2

63 views
Skip to first unread message

Sharat Koya

unread,
Oct 21, 2024, 12:24:54 PM10/21/24
to vert.x
I am attempting to setup an oath2 proxy using vertx to protect a legacy web application. However, I can’t seem to get the callback right after authentication. Can anyone help me understand what the routing rules should be?

Some how need to protect the app on port 8200, using the proxy on 8201 but need a callback that doesn’t get stuck in a loop.

v = Vertx.vertx();
 HttpClient proxyClient = v.createHttpClient(); 
 HttpProxy httpProxy = HttpProxy.reverseProxy(proxyClient); 
 Router proxyRouter = Router.router(v); 
 HttpServer proxyServer = v.createHttpServer(); 

 OAuth2Auth authProvider = AzureADAuth.create(v, "CLIENT_ID", "CLIENT_SECRET", "TENANT_ID"); 
 
OAuth2AuthHandler oauth2 = OAuth2AuthHandler.create(v, authProvider, "http://localhost:8201/callback"); 

 oauth2.setupCallback(proxyRouter.route("/callback")); proxyRouter.route("/*").handler(oauth2); 

 proxyRouter.route(HttpMethod.GET, "/*").handler(ProxyHandler.create(httpProxy, 8200, "localhost")); 

 proxyServer.requestHandler(proxyRouter).listen(8201);

Thomas SEGISMONT

unread,
Oct 25, 2024, 7:28:30 PM10/25/24

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/6a54a015-ebb5-4180-bdd3-7d9420cfb4e7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages