Here is the gist. My have a subclass of CookieAuthenticator. The constructor specifics the loginPath to '/login'. The application adds a route to '/login' and the class is a LoginResource.class. I'm not sure what to implement in this class.If you could point me to a working example or shed some light you would be most helpful.
Hello there,I've updated to Reslet 2.2-M6, replaced my HTTP Basic Guard with CookieAuthenticator, and when trying to access a guarded resource, instead of the login dialog I got HTTP 401 and this on logs:2014-01-03 11:25:24 0:0:0:0:0:0:0:1%0 - 0:0:0:0:0:0:0:1%0 9000 GET /res/dojo-release/dijit/themes/claro/images/tooltipGradient.png - 200 - 0 6 http://localhost:9000 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 http://localhost:9000/res/dojo-release/dijit/themes/claro/claro.css
2014-01-03 11:25:25 0:0:0:0:0:0:0:1%0 - 0:0:0:0:0:0:0:1%0 9000 GET /workspaces/ - 401 424 0 http://localhost:9000 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 http://localhost:9000/
Challenge scheme HTTP_Cookie not supported by the Restlet engine.
2014-01-03 11:25:25 0:0:0:0:0:0:0:1%0 - 0:0:0:0:0:0:0:1%0 9000 GET /favicon.ico - 401 424 0 http://localhost:9000 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 -
Challenge scheme HTTP_Cookie not supported by the Restlet engine.
2014-01-03 11:25:25 0:0:0:0:0:0:0:1%0 - 0:0:0:0:0:0:0:1%0 9000 GET /favicon.ico - 401 424 0 http://localhost:9000 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 -
Challenge scheme HTTP_Cookie not supported by the Restlet engine.
What's going on? What am I doing wrong?
Thanks in advance for your help.
On Fri, Jan 3, 2014 at 7:53 AM, Fabián Mandelbaum <fmand...@gmail.com> wrote:Hello Tim,thanks for your answers.I've tried, using the example in the Restlet IN ACTION book as a guide, what you proposed, the two chained authenticators, and it does not work.I've chained them like this:cookieauth -> httpauth -> guarded_resourcesI'll test with Restlet 2.2 today, though I don't know if we can switch our stable project to the still unstable Restlet 2.2...BTW, Restlet ppl, any idea on when 2.2 will become 'final'? The roadmap page on the Restlet website states Q3 2013... and that's about 3 months ago now...Thanks.On Thu, Jan 2, 2014 at 3:32 PM, Tim Peierls <t...@peierls.net> wrote:Not sure how much of this works in Restlet 2.1 -- I use CookieAuthenticator successfully with Restlet 2.2.On Thu, Jan 2, 2014 at 1:32 PM, Tim Peierls <t...@peierls.net> wrote:It should be possible to chain two different Authenticator instances, with optional = true on the first, and multiAuthenticating = false on the second. If the first one succeeds, the second should see ClientInfo.isAuthenticated() == true and bypass its operation. If the first one fails, the second one sees ClientInfo.isAuthenticated() == false and does not bypass its operation.But before you try that, consider using CookieAuthenticator -- much of the implementation is parameterized and/or overridable.On Thu, Jan 2, 2014 at 7:29 AM, Fabian Mandelbaum <fmand...@gmail.com> wrote:Hello there,our Restlet-based application needs to have users authenticated using both cookies and http basic (hopefully to be switched to digest soon) authentication (Actually it's either cookies or http auth, but see below for auth flow). We also use our own verifier storing credentials on JCR and set it as the defaultVerifier() for the app's context in createInboundRoot().I've seen that the ChallengeAuthenticator class only accepts one authentication method on its constructor so, a priori, one cannot have a Guard that uses more than one auth method.The authentication workflow with the Guard/Authenticator our app needs would be something like this:1) If cookie is present, verify it2) if cookie verification passes, all OK, continue processing request3) if cookie verification fails, use HTTP authenticationIs this possible with Restlet 2.1?I'd appreciate any guide/pointer/idea you may have. Thanks in advance.
// login/logout
router.attach(“/login",createCookieGuard(LoginEndPoint.class));
router.attach(“/logout", createCookieGuard(LogoutEndPoint.class));
@Override
protected boolean isLoggingIn(Request request, Response response) {
boolean isLoggingIn = isInterceptingLogin();
String loginPath = getLoginPath();
String requestedPath = request.getResourceRef().getPath();
return isLoggingIn
&& loginPath
.equals(requestedPath)
&& Method.POST.equals(request.getMethod());
}
3. Same with Logout
protected boolean isLoggingOut(Request request, Response response) {
boolean isLoggingOut = isInterceptingLogout();
String logoutPath = getLogoutPath();
String requestedPath = request.getResourceRef().getPath();
return isLoggingOut
&&
logoutPath.equals(requestedPath)
&& (Method.GET.equals(request.getMethod()) || Method.POST
.equals(request.getMethod()));
}I could be doing this unecessarily but i didn’t see a good example in the documentation. My next objective is to send back error=true to the login.html via a query parameter.It would be best to include a working example in the restlet.com user guide and distribution. Do you need assistance or do you have it covered?Thanks again for your help.-ray
I have had everything working nicely for a few years now. Some day, if I have time, I'll try to document what I did in a generic and reusable way.
To unsubscribe from this group and stop receiving emails from it, send an email to framework-disc...@restlet.org.