mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 17:40:31 +00:00
Removed prints
Enabled additional reverse proxy authentication for opds feeds (fixes #2399)
This commit is contained in:
parent
f8fbc807f1
commit
ac13f6042a
@ -46,6 +46,7 @@ class MyLoginManager(LoginManager):
|
|||||||
if user is not None:
|
if user is not None:
|
||||||
app = current_app._get_current_object()
|
app = current_app._get_current_object()
|
||||||
user_loaded_from_cookie.send(app, user=user)
|
user_loaded_from_cookie.send(app, user=user)
|
||||||
|
# if session was restored from remember me cookie make login valid
|
||||||
confirm_login()
|
confirm_login()
|
||||||
return user
|
return user
|
||||||
return None
|
return None
|
||||||
|
@ -101,13 +101,8 @@ def admin_required(f):
|
|||||||
|
|
||||||
@admi.before_app_request
|
@admi.before_app_request
|
||||||
def before_request():
|
def before_request():
|
||||||
# make remember me function work
|
if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path:
|
||||||
#if current_user.is_authenticated:
|
logout_user()
|
||||||
# print("before request confirm request {}".format(request.path))
|
|
||||||
# confirm_login()
|
|
||||||
#if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path:
|
|
||||||
# log.info("before logout {}".format(request.path))
|
|
||||||
# logout_user()
|
|
||||||
g.constants = constants
|
g.constants = constants
|
||||||
# g.user = current_user
|
# g.user = current_user
|
||||||
g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION','')
|
g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION','')
|
||||||
|
@ -89,7 +89,6 @@ def get_object_details(user=None,query_filter=None):
|
|||||||
|
|
||||||
|
|
||||||
def bind():
|
def bind():
|
||||||
print("bind")
|
|
||||||
return _ldap.bind()
|
return _ldap.bind()
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,9 +40,11 @@ def requires_basic_auth_if_no_ano(f):
|
|||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated(*args, **kwargs):
|
def decorated(*args, **kwargs):
|
||||||
auth = request.authorization
|
auth = request.authorization
|
||||||
print("opds_requires_basic_auth")
|
if not auth or auth.type != 'basic':
|
||||||
if (not auth or auth.type != 'basic'):
|
|
||||||
if config.config_anonbrowse != 1:
|
if config.config_anonbrowse != 1:
|
||||||
|
user = load_user_from_reverse_proxy_header(request)
|
||||||
|
if user:
|
||||||
|
return f(*args, **kwargs)
|
||||||
return _authenticate()
|
return _authenticate()
|
||||||
else:
|
else:
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
@ -86,14 +88,12 @@ def _fetch_user_by_name(username):
|
|||||||
|
|
||||||
@lm.user_loader
|
@lm.user_loader
|
||||||
def load_user(user_id):
|
def load_user(user_id):
|
||||||
print("load_user: {}".format(user_id))
|
|
||||||
user = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
|
user = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
@lm.request_loader
|
@lm.request_loader
|
||||||
def load_user_from_request(req):
|
def load_user_from_reverse_proxy_header(req):
|
||||||
print("load_from_request")
|
|
||||||
if config.config_allow_reverse_proxy_header_login:
|
if config.config_allow_reverse_proxy_header_login:
|
||||||
rp_header_name = config.config_reverse_proxy_login_header_name
|
rp_header_name = config.config_reverse_proxy_login_header_name
|
||||||
if rp_header_name:
|
if rp_header_name:
|
||||||
|
Loading…
Reference in New Issue
Block a user