2017-10-29 19:42:35 +02:00
|
|
|
from mailu import db, models, app, limiter
|
2017-09-24 15:43:23 +02:00
|
|
|
from mailu.internal import internal, nginx
|
|
|
|
|
|
|
|
import flask
|
|
|
|
|
|
|
|
|
2017-10-22 16:43:06 +02:00
|
|
|
@internal.route("/auth/email")
|
2017-10-29 19:42:35 +02:00
|
|
|
@limiter.limit(
|
|
|
|
app.config["AUTH_RATELIMIT"],
|
|
|
|
lambda: flask.request.headers["Client-Ip"]
|
|
|
|
)
|
2017-09-24 15:43:23 +02:00
|
|
|
def nginx_authentication():
|
2017-10-22 16:43:06 +02:00
|
|
|
""" Main authentication endpoint for Nginx email server
|
|
|
|
"""
|
2017-09-24 15:43:23 +02:00
|
|
|
headers = nginx.handle_authentication(flask.request.headers)
|
|
|
|
response = flask.Response()
|
|
|
|
for key, value in headers.items():
|
|
|
|
response.headers[key] = str(value)
|
|
|
|
return response
|