? No Code Attached Yet
avatar wilsonge
wilsonge
23 Feb 2017

As a fallout from #10890 we should think about what status codes we want to display when a user cannot login to the system. Currently we return a 200 in all cases. We probably want to consider a 403 and also changing the status codes in these exceptions https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/application/cms.php#L889-L896 to actually be something that makes sense and then use them.

avatar wilsonge wilsonge - open - 23 Feb 2017
avatar joomla-cms-bot joomla-cms-bot - change - 23 Feb 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Feb 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Mar 2017
Category com_users
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2017
Status New Needs Review
avatar brianteeman
brianteeman - comment - 3 Oct 2017
  1. 401 is the correct status code not 403

401 Unauthorized (RFC 7235) https://tools.ietf.org/html/rfc7235#section-3.1

The 401 (Unauthorized) status code indicates that the request has not
been applied because it lacks valid authentication credentials for
the target resource. The server generating a 401 response MUST send
a WWW-Authenticate header field (Section 4.1) containing at least one
challenge applicable to the target resource.

If the request included authentication credentials, then the 401
response indicates that authorization has been refused for those
credentials. The user agent MAY repeat the request with a new or
replaced Authorization header field (Section 4.2). If the 401
response contains the same challenge as the prior response, and the
user agent has already attempted authentication at least once, then
the user agent SHOULD present the enclosed representation to the
user, since it usually contains relevant diagnostic information.

  1. Where are we actually using the code?
    New reference is
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Oct 2017
Status Needs Review Information Required
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 22 Oct 2017

@wilsonge close this Issue?

avatar wilsonge
wilsonge - comment - 22 Oct 2017

I don't have the time to properly work my way through this right now - so not right now please. Assuming Brian is right about the 401 then this requires changes and so is an open issue (because iirc at the moment everything gives 200's)

avatar brianteeman
brianteeman - comment - 22 Oct 2017

"assuming brian is right"? I just quote the internet standards

avatar Bakual
Bakual - comment - 23 Oct 2017

I'm not convinced 401 is correct. What would you pass as WWW-Authenticate header then?
Stackoverflow often says 400 or 403. Or just 200 like we do currently because because from a protocol/server view the request still was successful.

avatar brianteeman
brianteeman - comment - 23 Oct 2017

I would rather follow the official standards than a comment on stack overflow ;)

avatar Bakual
Bakual - comment - 23 Oct 2017

The status code is built for the HTTP authentication methods (basic, digest, ...) and thus the official standard mandates that you MUST send a WWW-Authenticate header in the response so the browser knows what to do.
It's not a real fit for CMS authentications as we don't do it on a protocol level.

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Dec 2017
Status Information Required Discussion
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 15 Aug 2018

Reading this again I agree with @Bakual (I think)

What do other web based apps do?

avatar brianteeman brianteeman - change - 10 Feb 2020
Labels Added: ?
Removed: J3 Issue
avatar brianteeman brianteeman - unlabeled - 10 Feb 2020
avatar brianteeman brianteeman - labeled - 10 Feb 2020
avatar brianteeman
brianteeman - comment - 24 Aug 2022

So I just spent some time looking to see what others do. I can see that w and d have regularly had this same discussion over the years. Someone who did even more research on this @johnbillion and say that 200 is correct - so no change https://core.trac.wordpress.org/ticket/25446#comment:29

avatar joomdonation joomdonation - change - 12 Nov 2022
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2022-11-12 08:48:09
Closed_By joomdonation
Labels Added: ? No Code Attached Yet
Removed: ? ?
avatar joomdonation joomdonation - close - 12 Nov 2022
avatar joomdonation
joomdonation - comment - 12 Nov 2022

Base on research from @brianteeman, return 200 for http code is OK (see comment above), so I'm closing this issue. Feel free to re-open if needed.

Add a Comment

Login with GitHub to post a comment