package
0.0.0-20241222002135-c9d1db9af773
Repository: https://github.com/alphaone1/midgard.git
Documentation: pkg.go.dev
# README
Map Authorizer
The map authorizer is a simple user-password matcher. It is configured inside the program. It is, next to "always true", one of the most simple authorizers possible.
Example
handler := midgard.StackMiddlewareHandler(
[]defs.Middleware{
util.Must(New(
WithAuthenticator(util.Must(
map_auth.New(map_auth.WithAuths(map[string]string{
"user0": "pass0",
"user1": "pass1",
})))),
WithRealm("testrealm"))),
},
http.HandlerFunc(util.DummyHandler),
)
Be aware that writing credentials inside of program code is not advisable and is just used here to illustrate the usage.
# Structs
MapAuthenticator holds the authentication relevant data.