Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foomo/htpasswd
golang htpasswd utilities
https://github.com/foomo/htpasswd
Last synced: about 1 month ago
JSON representation
golang htpasswd utilities
- Host: GitHub
- URL: https://github.com/foomo/htpasswd
- Owner: foomo
- License: mit
- Created: 2016-02-12T09:57:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-22T10:12:03.000Z (almost 5 years ago)
- Last Synced: 2024-11-04T17:47:30.600Z (about 1 month ago)
- Language: Go
- Size: 9.77 KB
- Stars: 40
- Watchers: 8
- Forks: 21
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
![Travis CI](https://travis-ci.org/foomo/htpasswd.svg?branch=master)
# This is a simple utility library to manipulate htpasswd files
If you want to authenticate against a htpasswd file use something like https://github.com/abbot/go-http-auth .
## Supported hashing algorithms:
- apr1 (do not use except for legacy support situations)
- sha (do not use except for legacy support situations)
- bcrypt## This is what you can
Set user credentials in a htpasswd file:
```Go
file := "/tmp/demo.htpasswd"
name := "joe"
password := "secret"
err := htpasswd.SetPassword(file, name, password, htpasswd.HashBCrypt)
```Remove a user:
```Go
err := htpasswd.RemoveUser(file, name)
```Read user hash table:
```Go
passwords, err := htpasswd.ParseHtpasswdFile(file)
```Have fun.