Skip to content

Quoted-string Basic realm ctx according to rfc7235 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Quoted-string Basic realm ctx according to rfc7235
Hi,

I faced some problems with 401 message and an Android client.

It yelded because in the WWW-Authenticate header the
Basic ream=<ctx>
wasn't surrouned by ""

In the https://tools.ietf.org/html/rfc7235 it is written that 
 - Authentication parameters are name=value pairs
 - and "auth-param     = token BWS "=" BWS ( token / quoted-string )"
 - and "For historical reasons, a sender MUST only generate the quoted-string
   syntax.  Recipients might have to support both token and
   quoted-string syntax for maximum interoperability with existing
   clients that have been accepting both notations for a long time."

After my modification, the Android worked again (and iOs and PC clients faicing the 401 still worked ;) )

BR,
Arfy
  • Loading branch information
ArfyFR authored Nov 3, 2016
commit 64bb271b2ead1c659a41c4fababbe97b453b7542
4 changes: 2 additions & 2 deletions nginx-ldap-auth-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def do_GET(self):
if auth_header is None or not auth_header.lower().startswith('basic '):

self.send_response(401)
self.send_header('WWW-Authenticate', 'Basic realm=' + ctx['realm'])
self.send_header('WWW-Authenticate', 'Basic realm="' + ctx['realm'] + '"')
self.send_header('Cache-Control', 'no-cache')
self.end_headers()

Expand Down Expand Up @@ -115,7 +115,7 @@ def auth_failed(self, ctx, errmsg = None):

self.log_error(msg)
self.send_response(401)
self.send_header('WWW-Authenticate', 'Basic realm=' + ctx['realm'])
self.send_header('WWW-Authenticate', 'Basic realm="' + ctx['realm'] + '"')
self.send_header('Cache-Control', 'no-cache')
self.end_headers()

Expand Down