Update authentication method

This commit is contained in:
2023-11-18 18:20:29 +11:00
parent 9d9ffc9122
commit 3b3ad66ba3
24 changed files with 273 additions and 25 deletions

View File

@@ -0,0 +1,17 @@
module Adamantium
module Middleware
class Authenticate
def initialize(app, auth_proc)
@app = app
@auth_proc = auth_proc
end
def call(env)
session = env["rack.session"]
return [403, {'Content-Type' => 'text/html'}, ["Unauthorized | <a href=\"/admin/login\">Login</>"]] unless @auth_proc.call(session[:user_id])
@app.call(env)
end
end
end
end

View File

@@ -1,14 +0,0 @@
module Adamantium
module Middleware
class ProcessParams
def initialize(app)
@app = app
end
def call(env)
# NOOP for now.
@app.call(env)
end
end
end
end