我想使用基本身份验证来保护我的骆驼路线。我将netty4-http
组件与骆驼Rest DSL
一起使用。 documentation暗示可能。
我已经看到一些有关如何使用jetty
组件here和示例here来实现此目的的帖子。
但是,我不确定如何使用netty4-http
组件来保护我的路线吗?到目前为止,我已经写了以下内容,但是可以确定我缺少什么吗?:
public class Route extends RouteBuilder {
@Override
public void configure() throws Exception {
HttpConfiguration config = new HttpConfiguration();
config.setAuthMethod("Basic");
config.setAuthUsername("myUser");
config.setAuthPassword("myPassword");
restConfiguration()
.component("netty4-http")
.scheme("http")
.host("0.0.0.0")
.port(8080)
.bindingMode(RestBindingMode.auto);
非常感谢您的帮助。