Re: How to set up a servlet to return HTTP error status instead of redirecting to the login form?

2017-03-01 Thread Bertrand Delacretaz
On Tue, Feb 28, 2017 at 10:17 PM, John Logan wrote: > ...The SlingAuthenticator.doLogin() method first > calls AuthUtil.isBrowserRequest(), and if the return value is true, then > calls AuthUtil.isAjaxRequest(). This method returns true if the following > header is

Re: How to set up a servlet to return HTTP error status instead of redirecting to the login form?

2017-02-28 Thread John Logan
On Tuesday, February 28, 2017 11:50 AM, John Logan wrote: > On Tuesday, February 28, 2017 6:33 AM, Bertrand Delacretaz > wrote: [snip] > > AFAIK it's the AuthUtil.isBrowserRequest method [1] that makes this > > decision. [snip] > > I suppose

Re: How to set up a servlet to return HTTP error status instead of redirecting to the login form?

2017-02-28 Thread John Logan
Hi Bertrand, Thanks for your response! I appreciate your help. On Tuesday, February 28, 2017 6:33 AM, Bertrand Delacretaz wrote: > Hi John, > > On Mon, Feb 27, 2017 at 10:11 PM, John Logan wrote: > > ...I receive 302 if the curl request

Re: How to set up a servlet to return HTTP error status instead of redirecting to the login form?

2017-02-28 Thread Bertrand Delacretaz
Hi John, On Mon, Feb 27, 2017 at 10:11 PM, John Logan wrote: > ...I receive 302 if the curl request includes the user agent, and > 401 otherwise AFAIK it's the AuthUtil.isBrowserRequest method [1] that makes this decision. > I don't think this helps for browser

How to set up a servlet to return HTTP error status instead of redirecting to the login form?

2017-02-27 Thread John Logan
Hello! I'm running into an issue where I've created a Sling servlet that queries nodes and returns a JSON result. My web application uses the form-based AuthenticationHandler to establish a session, and then fetches the resource provided by my servlet. This works fine until the session times