This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic Basic Auth * Allow username and password to be passed in via env vars * Add test spec for basic auth returning 401 * Update README with Basic Auth config info * Add .htpasswd to test fixture * Set env vars in test * Request the file that actually exists, maybe? * Is context the key? * Perhaps app.run needs to come to the party too? * Move `auth_basic` from `location` to `server` * Set `basic_auth` as true if env `basic_auth_username` exists * Fix htpasswd generation when basic_auth is false * Append env password instead truncating * Fix typo * Fix config example in README
- Loading branch information
1 parent
2d643c5
commit bde9522
Showing
9 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'json' | ||
|
||
USER_CONFIG = "/app/static.json" | ||
|
||
config = {} | ||
config = JSON.parse(File.read(USER_CONFIG)) if File.exist?(USER_CONFIG) | ||
|
||
HTPASSWD = config["basic_auth_htpasswd_path"] || '/app/.htpasswd' | ||
USERNAME = ENV["BASIC_AUTH_USERNAME"] | ||
PASSWORD = ENV["BASIC_AUTH_PASSWORD"] | ||
|
||
htpasswd = "#{USERNAME}:#{PASSWORD}" unless (USERNAME.nil? || PASSWORD.nil?) | ||
|
||
File.open(HTPASSWD, 'a') { |file| file.puts(htpasswd) } if !htpasswd.nil? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test:$apr1$Dnavu2z9$ZFxQn/mXVQoeYGD.tA2bW/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foobar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"basic_auth": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters