Skip to content

Commit

Permalink
Application settings authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
gkostin1966 committed May 2, 2024
1 parent 2f0563d commit 9678aa3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lauth/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
AUTHORIZATION="Basic Auth"
DATABASE_URL=mysql2://lauth:lauth@db.lauth.local:3306/lauth_development
SESSION_SECRET=__local_development_secret_only__
1 change: 1 addition & 0 deletions lauth/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
AUTHORIZATION="Basic Lauth"
DATABASE_URL=mysql2://lauth:lauth@db.lauth.local:3306/lauth_test
SESSION_SECRET=__local_development_secret_only__
2 changes: 1 addition & 1 deletion lauth/app/actions/authorize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Authorize < Lauth::Action
def handle(request, response)
response.format = :json

if request.has_header?("Authorization") && request.get_header("Authorization") == "Basic Lauth"
if request.has_header?("Authorization") && request.get_header("Authorization") == App.app["settings"].authorization
result = Lauth::Ops::Authorize.new(
request: Lauth::Access::Request.new(
user: request.params[:user],
Expand Down
1 change: 1 addition & 0 deletions lauth/config/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Lauth
class Settings < Hanami::Settings
setting :authorization, constructor: Types::String
setting :database_url, constructor: Types::String
setting :session_secret, constructor: Types::String
end
Expand Down

0 comments on commit 9678aa3

Please sign in to comment.