Registry / auth / abbot-go-http-auth

abbot-go-http-auth

JSON →
library0.4.0gogounverified

An implementation of HTTP Basic and HTTP Digest authentication.

go get github.com/abbot/go-http-auth
INSTALL
IMPORT
SIG · ABBOT-GO-HTTP-AUTH
A
abbot-go-http-auth
authgov0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

auth
github.com/abbot/go-http-auth

Sets up HTTP Basic authentication for a web server.

package main import ( "net/http" "github.com/abbot/go-http-auth" ) func Secret(user, realm string) string { if user == "admin" { return "$1$da$3cGG9D5Mh2xxv3e7CwPJp/" } return "" } func main() { authenticator := auth.NewBasicAuthenticator("example.com", Secret) http.HandleFunc("/", authenticator.Wrap(func(w http.ResponseWriter, r *auth.AuthenticatedRequest) { w.Write([]byte("Hello, " + r.Username)) })) http.ListenAndServe(":8080", nil) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.4.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
49 hits · last 30 days
node
38
Resources
abbot-go-http-auth — go get abbot-go-http-auth · libregistry