【发布时间】:2011-07-28 07:13:32
【问题描述】:
我们使用的是 Restlet 2.0.8 并且有一个应用程序实例覆盖了 org.restlet.Application#createInboundRoot()。在那里,我们创建了 Router 实例并(目前)返回一个 DigestAuthenticator,如下面的代码所示:
@Override
public synchronized Restlet createInboundRoot() {
log.info("App::createInboundRoot called");
this.authenticator = getAuthenticator();
Router router = new Router(getContext());
router.attach("/echo", EchoResource.class);
router.attach("/status", StatusResource.class);
authenticator.setNext(router);
return authenticator;
}
private ChallengeAuthenticator getAuthenticator() {
DigestAuthenticator auth = new DigestAuthenticator(getContext(), "Guard", "s3cret");
auth.setWrappedVerifier(new SimpleVerifier("user","pass");
auth.setOptional(false);
return auth;
}
我想要实现的是:
- 让 EchoResource 使用摘要身份验证,而 StatusResource 应该使用 HTTP 基本身份验证
Restlets 可以做到这一点吗?
最好, 克里斯
【问题讨论】:
标签: java restlet basic-authentication http-digest