|
|
|
@ -45,13 +45,13 @@ type BasicAuther interface {
|
|
|
|
|
// HashCache store hash values for users. Safe for use from multiple goroutines.
|
|
|
|
|
type HashCache struct {
|
|
|
|
|
mu sync.RWMutex
|
|
|
|
|
m map[string]map[string]bool
|
|
|
|
|
m map[string]map[string]struct{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewHashCache returns a instantiated HashCache
|
|
|
|
|
func NewHashCache() *HashCache {
|
|
|
|
|
return &HashCache{
|
|
|
|
|
m: make(map[string]map[string]bool),
|
|
|
|
|
m: make(map[string]map[string]struct{}),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -74,9 +74,9 @@ func (h *HashCache) Store(username, hash string) {
|
|
|
|
|
defer h.mu.Unlock()
|
|
|
|
|
_, ok := h.m[username]
|
|
|
|
|
if !ok {
|
|
|
|
|
h.m[username] = make(map[string]bool)
|
|
|
|
|
h.m[username] = make(map[string]struct{})
|
|
|
|
|
}
|
|
|
|
|
h.m[username][hash] = true
|
|
|
|
|
h.m[username][hash] = struct{}{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Credential represents authentication and authorization configuration for a single user.
|
|
|
|
|