client: add memory manager instantiator
@@ -2,7 +2,6 @@ package client
import (
"sync"
-
"context"
"github.com/imdario/mergo"
@@ -18,6 +17,17 @@ type MemoryManager struct {
sync.RWMutex
}
+func NewMemoryManager(hasher fosite.Hasher) *MemoryManager {
+ if hasher == nil {
+ hasher = new(fosite.BCrypt)
+ }
+
+ return &MemoryManager{
+ Clients: map[string]Client{},
+ Hasher: hasher,
+ }
+}
+
func (m *MemoryManager) GetConcreteClient(id string) (*Client, error) {
m.RLock()
defer m.RUnlock()
