mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Revert "Merge pull request #2944 from guo-sj/handle_implicit_username"
This reverts commitbc96e73b8d
, reversing changes made to88a669dd19
.
This commit is contained in:
parent
3aa4dc6ad5
commit
bdc4d67de8
|
@ -377,18 +377,6 @@ func (iama *IamApiServer) DeleteAccessKey(s3cfg *iam_pb.S3ApiConfiguration, valu
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleImplicitUsername adds username who signs the request to values if 'username' is not specified
|
|
||||||
// According to https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/create-access-key.html/
|
|
||||||
// "If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web
|
|
||||||
// Services access key ID signing the request."
|
|
||||||
func handleImplicitUsername(r *http.Request, values url.Values) {
|
|
||||||
if values.Get("UserName") == "" {
|
|
||||||
// get username who signs the request
|
|
||||||
userName := strings.Split(r.Header["Authorization"][0], "/")[2]
|
|
||||||
values.Set("UserName", userName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {
|
func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := r.ParseForm(); err != nil {
|
if err := r.ParseForm(); err != nil {
|
||||||
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)
|
||||||
|
@ -413,7 +401,6 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {
|
||||||
response = iama.ListUsers(s3cfg, values)
|
response = iama.ListUsers(s3cfg, values)
|
||||||
changed = false
|
changed = false
|
||||||
case "ListAccessKeys":
|
case "ListAccessKeys":
|
||||||
handleImplicitUsername(r, values)
|
|
||||||
response = iama.ListAccessKeys(s3cfg, values)
|
response = iama.ListAccessKeys(s3cfg, values)
|
||||||
changed = false
|
changed = false
|
||||||
case "CreateUser":
|
case "CreateUser":
|
||||||
|
@ -441,10 +428,8 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "CreateAccessKey":
|
case "CreateAccessKey":
|
||||||
handleImplicitUsername(r, values)
|
|
||||||
response = iama.CreateAccessKey(s3cfg, values)
|
response = iama.CreateAccessKey(s3cfg, values)
|
||||||
case "DeleteAccessKey":
|
case "DeleteAccessKey":
|
||||||
handleImplicitUsername(r, values)
|
|
||||||
response = iama.DeleteAccessKey(s3cfg, values)
|
response = iama.DeleteAccessKey(s3cfg, values)
|
||||||
case "CreatePolicy":
|
case "CreatePolicy":
|
||||||
response, err = iama.CreatePolicy(s3cfg, values)
|
response, err = iama.CreatePolicy(s3cfg, values)
|
||||||
|
|
Loading…
Reference in a new issue