package store type MemoryAuthStore struct { Tokens map[string]RevokableToken } func NewMemoryAuthStore() *MemoryAuthStore { return &MemoryAuthStore{Tokens: map[string]RevokableToken{}} } func (s *MemoryAuthStore) Revoke(id string) error { if t, ok := s.Tokens[id]; ok { t.Revoked = true s.Tokens[id] = t } return nil } func (s *MemoryAuthStore) IsRevoked(id string) bool { if t, ok := s.Tokens[id]; ok { return t.Revoked } return false } func (s *MemoryAuthStore) Add(token RevokableToken) error { s.Tokens[token.ID] = token return nil } func (s *MemoryAuthStore) Remove(id string) error { delete(s.Tokens, id) return nil } func (s *MemoryAuthStore) RevokeUser(subject string) error { for id, token := range s.Tokens { if token.Subject == subject { token.Revoked = true s.Tokens[id] = token } } return nil }