Commit e1233c9d authored by Vincent Pelletier's avatar Vincent Pelletier

wsgi: Subclass Unauthorized when dealing with SSL authentication error.

Allows introducing more reasons to reject authentication, with different
WWW-Authenticate values.
parent 18a817e4
...@@ -53,6 +53,11 @@ class Unauthorized(ApplicationError): ...@@ -53,6 +53,11 @@ class Unauthorized(ApplicationError):
HTTP unauthorized error HTTP unauthorized error
""" """
status = _getStatus(httplib.UNAUTHORIZED) status = _getStatus(httplib.UNAUTHORIZED)
class SSLUnauthorized(Unauthorized):
"""
Authentication failed because of SSL credentials (missing or incorrect)
"""
_response_headers = [ _response_headers = [
# XXX: non standard scheme, suggested in # XXX: non standard scheme, suggested in
# https://www.ietf.org/mail-archive/web/httpbisa/current/msg03764.html # https://www.ietf.org/mail-archive/web/httpbisa/current/msg03764.html
...@@ -250,7 +255,7 @@ class Application(object): ...@@ -250,7 +255,7 @@ class Application(object):
), ),
) )
except (exceptions.CertificateVerificationError, ValueError): except (exceptions.CertificateVerificationError, ValueError):
raise Unauthorized raise SSLUnauthorized
header_list.append(('Cache-Control', 'private')) header_list.append(('Cache-Control', 'private'))
def _readJSON(self, environ): def _readJSON(self, environ):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment