Skip to content
Snippets Groups Projects
Commit 4e1d51ad authored by godog's avatar godog
Browse files

unquote user/pass from nginx

nginx-mail-mapper did the same, which should be enough to make password with %
work, note however that nginx escapes only " " and "%" in this case
(function ngx_escape_uri)
parent caca6dfa
No related branches found
No related tags found
No related merge requests found
import socket import socket
import threading import threading
import urllib
from flask import Flask, request, abort, make_response from flask import Flask, request, abort, make_response
from authserv.app_common import do_auth from authserv.app_common import do_auth
...@@ -21,8 +22,8 @@ def _shard_to_ip(shard): ...@@ -21,8 +22,8 @@ def _shard_to_ip(shard):
@app.route('/', methods=('GET',)) @app.route('/', methods=('GET',))
def do_nginx_http_auth(): def do_nginx_http_auth():
service = app.config.get('NGINX_AUTH_SERVICE', 'mail') service = app.config.get('NGINX_AUTH_SERVICE', 'mail')
username = request.environ.get('HTTP_AUTH_USER') username = urllib.unquote(request.environ.get('HTTP_AUTH_USER'))
password = request.environ.get('HTTP_AUTH_PASS') password = urllib.unquote(request.environ.get('HTTP_AUTH_PASS'))
source_ip = request.environ.get('HTTP_CLIENT_IP') source_ip = request.environ.get('HTTP_CLIENT_IP')
protocol = request.environ.get('HTTP_AUTH_PROTOCOL') protocol = request.environ.get('HTTP_AUTH_PROTOCOL')
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment