1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00
This commit is contained in:
Makis Maropoulos
2016-05-31 11:05:42 +03:00
parent c26668a489
commit 31cbd50fb0
18 changed files with 177 additions and 67 deletions

View File

@@ -7,10 +7,14 @@ import (
)
const (
DefaultBasicAuthRealm = "Authorization Required"
// DefaultBasicAuth is "Authorization Required"
DefaultBasicAuthRealm = "Authorization Required"
// DefaultBasicAuthContextKey is the "auth"
// this key is used to do context.Set("auth", theUsernameFromBasicAuth)
DefaultBasicAuthContextKey = "auth"
)
// BasicAuth the configs for the basicauth middleware
type BasicAuth struct {
// Users a map of login and the value (username/password)
Users map[string]string
@@ -27,7 +31,7 @@ func DefaultBasicAuth() BasicAuth {
return BasicAuth{make(map[string]string), DefaultBasicAuthRealm, DefaultBasicAuthContextKey, 0}
}
// Merge MergeSingle the default with the given config and returns the result
// MergeSingle merges the default with the given config and returns the result
func (c BasicAuth) MergeSingle(cfg BasicAuth) (config BasicAuth) {
config = cfg