Implement authorization support

This commit is contained in:
Harshavardhana
2015-02-06 02:08:52 -08:00
parent eba86c07e9
commit 81fc11ee5d
4 changed files with 234 additions and 188 deletions

View File

@@ -55,6 +55,14 @@ func (c *Config) IsUserExists(username string) bool {
return false
}
func (c *Config) GetKey(accessKey string) User {
value, ok := c.Users[accessKey]
if !ok {
return User{}
}
return value
}
func (c *Config) GetUser(username string) User {
for _, user := range c.Users {
if user.Name == username {