Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dencoded committed Aug 29, 2019
1 parent 1406145 commit f1dc5cf
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions gateway/auth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,25 @@ func (b *DefaultSessionManager) SessionDetail(keyName string, hashed bool) (user
if hashed {
jsonKeyVal, err = b.store.GetRawKey(b.store.GetKeyPrefix() + keyName)
} else {
// try to get legacy and new format key at once
var jsonKeyValList []string
jsonKeyValList, err = b.store.GetMultiKey(
[]string{
keyName,
generateToken(b.orgID, keyName),
},
)
// pick the 1st non empty from the returned list
for _, val := range jsonKeyValList {
if val != "" {
jsonKeyVal = val
break
if storage.TokenOrg(keyName) != b.orgID {
// try to get legacy and new format key at once
var jsonKeyValList []string
jsonKeyValList, err = b.store.GetMultiKey(
[]string{
keyName,
generateToken(b.orgID, keyName),
},
)
// pick the 1st non empty from the returned list
for _, val := range jsonKeyValList {
if val != "" {
jsonKeyVal = val
break
}
}
} else {
// key is not an imported one
jsonKeyVal, err = b.store.GetKey(keyName)
}
}

Expand Down

0 comments on commit f1dc5cf

Please sign in to comment.