Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading credentials from io.Reader #3

Merged
merged 1 commit into from
Mar 5, 2019
Merged

Support loading credentials from io.Reader #3

merged 1 commit into from
Mar 5, 2019

Conversation

pschultz
Copy link
Contributor

@pschultz pschultz commented Mar 5, 2019

Add the NewFromReader constructor and ReloadFromReader method for
*HtpasswdFile.

This makes it easier for users that receive credentials from sources
other than a file, because they don't have to create temporary files:

htp, _ := htpasswd.NewFromReader(strings.NewReader("foo:{PLAIN}bar"), htpasswd.DefaultSystems, nil)
fmt.Println(htp.Match("foo", "bar")) // Output: true

_ = htp.ReloadFromReader(strings.NewReader("foo:{PLAIN}baz"), nil)
fmt.Println(htp.Match("foo", "bar")) // Output: false

Add the NewFromReader constructor and ReloadFromReader method for
*HtpasswdFile.

This makes it easier for users that receive credentials from sources
other than a file, because they don't have to create temporary files.

Signed-off-by: Peter Schultz <peter.schultz@classmarkets.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants