0
我試圖在Restlet中執行身份驗證,我正在查找基於URI的一部分(即多租戶身份驗證)的憑據。Restlet - 在身份驗證器中使用URI模板變量
我一直無法將認證器的路由器鏈接到路由器進行資源訪問。這甚至有可能嗎?假設我有一個需要tenantId變量來查找用戶的Authenticator。我一直在嘗試像下面這樣的設置來使它無法成功地工作。思考?
public class MyApplication extends Application
{
public Authenticator authenticator;
@Override
public Restlet createInboundRoot()
{
Router router = new Router(getContext());
router.attach("/", TraceResource.class);
router.attach("/{apiVersion}/{tenantId}/pathOne/{someId}",
ResourceOne.class);
router.attach("/{apiVersion}/{tenantId}/pathTwo/{someId}",
ResourceTwo.class);
authenticator.setNext(router);
Router authenticationRouter = new Router(getContext());
authenticationRouter.attach("/{apiVersion}/{tenantId}/{remaining}",
authenticator).setMatchingMode(Template.MODE_STARTS_WITH);
return authenticationRouter;
}
}
謝謝!在這種情況下,authenticationRouter中的tenantId變量是否會給我提供「斜線之間」值?或者我需要解析它? – Mafuba
「tenantId」變量將包含剩餘的URI,包括斜槓 –