This commit is contained in:
Artur Gurgul 2025-08-04 19:07:10 +02:00
commit 793560c0c4
7 changed files with 97 additions and 0 deletions

15
auth_middleware.rb Normal file
View file

@ -0,0 +1,15 @@
class AuthMiddleware
def initialize(app)
@app = app
end
def call(env)
auth = env['HTTP_AUTHORIZATION']
if auth == "Bearer mysecrettoken"
@app.call(env)
else
[401, { "Content-Type" => "application/json" }, [{ error: "Unauthorized" }.to_json]]
end
end
end