feat: auth middleware

- CORS headers
- Get all links that belong to user
This commit is contained in:
Juan Rodriguez
2024-05-13 22:34:35 +02:00
parent 0ad534065c
commit 7f2a27ec79
9 changed files with 50 additions and 22 deletions
+15
View File
@@ -9,6 +9,21 @@ module App
end
end
class UnauthorizedException < Kemal::Exceptions::CustomException
def initialize(context)
context.response.status_code = 401
super(context)
end
end
class ForbiddenException < Kemal::Exceptions::CustomException
def initialize(context)
context.response.status_code = 403
context.response.print({ "error" => "Access not allowed" }.to_json)
super(context)
end
end
class NotFoundException < Kemal::Exceptions::CustomException
def initialize(context)
context.response.status_code = 404