auth

Paddy 2015-02-20 Parent:c03b5eb3179e Child:b7e685839a1b

134:d103a598548c Go to Latest

auth/memstore.go

Introduced scopes. Created a Scope type and a scopeStore interface, along with the memstore methods for the scopeStore. This will allow applications to define access with granularity, so users can grant access to some data, not _all_ data. We're operating on the assumption that there won't be an unreasonable number of scopes defined, so there is no paging operation included for the ListScopes method. This is a decision that may have to be revisited in the future, depending on usecases.

History
     1.1 --- a/memstore.go	Thu Jan 29 20:40:55 2015 -0500
     1.2 +++ b/memstore.go	Fri Feb 20 22:34:43 2015 -0500
     1.3 @@ -31,6 +31,9 @@
     1.4  
     1.5  	sessions    map[string]Session
     1.6  	sessionLock sync.RWMutex
     1.7 +
     1.8 +	scopes    map[string]Scope
     1.9 +	scopeLock sync.RWMutex
    1.10  }
    1.11  
    1.12  // NewMemstore returns an in-memory version of our datastores,
    1.13 @@ -50,6 +53,7 @@
    1.14  		logins:              map[string]Login{},
    1.15  		profileLoginLookup:  map[string][]string{},
    1.16  		sessions:            map[string]Session{},
    1.17 +		scopes:              map[string]Scope{},
    1.18  	}
    1.19  }
    1.20