java - Restlet - Using URI Template Variables in Authenticator -
i attempting perform authentication in restlet looking credentials based on portion of uri, i.e. multitenant authentication.
i have not been able chain router authenticator router resource access. possible? let's have authenticator needs tenantid variable user. i've been trying setup following work no success. thoughts?
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; } }
it's correct, here fix:
public class myapplication extends application { public authenticator authenticator; @override public restlet createinboundroot() { router router = new router(getcontext()); router.attach("/", traceresource.class); router.attach("/pathone/{someid}", resourceone.class); router.attach("/pathtwo/{someid}", resourcetwo.class); authenticator.setnext(router); router authenticationrouter = new router(getcontext()); authenticationrouter.attach("/{apiversion}/{tenantid}", authenticator).setmatchingmode(template.mode_starts_with); return authenticationrouter; } }
Comments
Post a Comment