jwt: Simplify JWT parsing (#8802)

JWT parsing is simplified by using a custom claim
data structure such as MapClaims{}, also writes
a custom Unmarshaller for faster unmarshalling.

- Avoid as much reflections as possible
- Provide the right types for functions as much
  as possible
- Avoid strings.Join, strings.Split to reduce
  allocations, rely on indexes directly.
This commit is contained in:
Harshavardhana
2020-01-31 08:29:22 +05:30
committed by GitHub
parent 9990464cd5
commit bfe8a9bccc
11 changed files with 799 additions and 252 deletions

View File

@@ -201,7 +201,9 @@ func getReqAccessCred(r *http.Request, region string) (cred auth.Credentials) {
if owner {
return globalActiveCred
}
cred, _ = globalIAMSys.GetUser(claims.AccessKey())
if claims != nil {
cred, _ = globalIAMSys.GetUser(claims.AccessKey)
}
}
return cred
}