mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-24 00:03:12 -04:00
Allow proxy authentication (#141)
This commit is contained in:
@@ -93,8 +93,18 @@ class AuthHandler < Kemal::Handler
|
||||
call_next env
|
||||
end
|
||||
|
||||
def handle_auth_proxy(env)
|
||||
username = env.request.headers[Config.current.auth_proxy_header_name]?
|
||||
unless username && Storage.default.username_exists username
|
||||
return redirect env, "/login"
|
||||
end
|
||||
call_next env
|
||||
end
|
||||
|
||||
def call(env)
|
||||
if request_path_startswith env, ["/opds"]
|
||||
if !Config.current.auth_proxy_header_name.empty?
|
||||
handle_auth_proxy env
|
||||
elsif request_path_startswith env, ["/opds"]
|
||||
handle_opds_auth env
|
||||
else
|
||||
handle_auth env
|
||||
|
||||
Reference in New Issue
Block a user