我在jhipster网关中通过zuul路由成功添加了外部api。但是,当我在邮递员中测试时,它并不需要任何身份验证。我需要使用jhipster提供的身份验证来保护此外部api。请指教
下面是我用来添加zuul路由的代码。
ZuulProperties.ZuulRoute zuulRoute = new ZuulProperties.ZuulRoute();
String path = externalapis.getPath();
zuulRoute.setId(externalapis.getServiceId());
zuulRoute.setStripPrefix(true);
zuulRoute.setServiceId(externalapis.getServiceId());
zuulRoute.setPath("/"+externalapis.getServiceId()+"/**");
zuulRoute.setLocation(externalapis.getUrl());
zuulRoute.setUrl(externalapis.getUrl());
zuulRoute.setRetryable(true);
this.zuulProperties.getRoutes().put(externalapis.getServiceId(), zuulRoute);
this.discoveryClientRouteLocator.refresh();