mirror of
https://github.com/minio/minio.git
synced 2025-02-03 01:46:00 -05:00
Merge pull request #846 from harshavardhana/new-changes
With new auth config changes, restructure the API code to use the new style
This commit is contained in:
commit
ac93bbb41d
@ -142,11 +142,14 @@ func (h validateAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Access key not found
|
// Access key not found
|
||||||
if _, ok := authConfig.Users[accessKeyID]; !ok {
|
for _, user := range authConfig.Users {
|
||||||
writeErrorResponse(w, r, InvalidAccessKeyID, acceptsContentType, r.URL.Path)
|
if user.AccessKeyID == accessKeyID {
|
||||||
|
h.handler.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.handler.ServeHTTP(w, r)
|
}
|
||||||
|
writeErrorResponse(w, r, InvalidAccessKeyID, acceptsContentType, r.URL.Path)
|
||||||
|
return
|
||||||
default:
|
default:
|
||||||
// control reaches here, we should just send the request up the stack - internally
|
// control reaches here, we should just send the request up the stack - internally
|
||||||
// individual calls will validate themselves against un-authenticated requests
|
// individual calls will validate themselves against un-authenticated requests
|
||||||
|
@ -79,14 +79,16 @@ func InitSignatureV4(req *http.Request) (*donut.Signature, *probe.Error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err.Trace()
|
return nil, err.Trace()
|
||||||
}
|
}
|
||||||
if _, ok := authConfig.Users[accessKeyID]; !ok {
|
for _, user := range authConfig.Users {
|
||||||
return nil, probe.NewError(errors.New("AccessID not found"))
|
if user.AccessKeyID == accessKeyID {
|
||||||
}
|
|
||||||
signature := &donut.Signature{
|
signature := &donut.Signature{
|
||||||
AccessKeyID: authConfig.Users[accessKeyID].AccessKeyID,
|
AccessKeyID: user.AccessKeyID,
|
||||||
SecretAccessKey: authConfig.Users[accessKeyID].SecretAccessKey,
|
SecretAccessKey: user.SecretAccessKey,
|
||||||
AuthHeader: ah,
|
AuthHeader: ah,
|
||||||
Request: req,
|
Request: req,
|
||||||
}
|
}
|
||||||
return signature, nil
|
return signature, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, probe.NewError(errors.New("AccessID not found"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user