Skip to content

Commit

Permalink
Make Swagger API public
Browse files Browse the repository at this point in the history
  • Loading branch information
woarewe committed Apr 4, 2023
1 parent 3e32d62 commit 1d01470
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 0 additions & 4 deletions app/gateways/rest/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ class API < Grape::API
PER_PAGE_LIMIT = 100
PER_PAGE_DEFAULT = 50

before do
authenticate!
end

namespace(:organizations) { mount Organizations }
namespace(:workers) { mount Workers }
namespace(:shifts) { mount Shifts }
Expand Down
9 changes: 9 additions & 0 deletions app/gateways/rest/api/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ module REST
class API
class Base < Grape::API
format "json"

def self.inherited(subclass)
super
subclass.instance_exec do
before do
authenticate!
end
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/gateways/rest/services/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def parse_payload!(payload)
invalid_format! if invalid_scheme?(scheme)

Base64
.decode64(token)
.decode64(token.to_s)
.then { |decoded| decoded.split(":") }
.tap { |username, password| invalid_format! if username.nil? || password.nil? }
end
Expand Down

0 comments on commit 1d01470

Please sign in to comment.