Rename to accessSecret

This commit is contained in:
Yang Luo
2023-06-16 20:42:15 +08:00
parent 98fb9f25b0
commit b01ba792bb
15 changed files with 83 additions and 16 deletions

View File

@ -26,10 +26,10 @@ import (
)
type Object struct {
Owner string `json:"owner"`
Name string `json:"name"`
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
Owner string `json:"owner"`
Name string `json:"name"`
AccessKey string `json:"accessKey"`
AccessSecret string `json:"accessSecret"`
}
func getUsername(ctx *context.Context) (username string) {
@ -107,14 +107,14 @@ func getKeys(ctx *context.Context) (string, string) {
method := ctx.Request.Method
if method == http.MethodGet {
accessKey := ctx.Input.Query("accesskey")
secretKey := ctx.Input.Query("secretkey")
return accessKey, secretKey
accessKey := ctx.Input.Query("accessKey")
accessSecret := ctx.Input.Query("accessSecret")
return accessKey, accessSecret
} else {
body := ctx.Input.RequestBody
if len(body) == 0 {
return ctx.Request.Form.Get("accesskey"), ctx.Request.Form.Get("secretkey")
return ctx.Request.Form.Get("accessKey"), ctx.Request.Form.Get("accessSecret")
}
var obj Object
@ -123,7 +123,7 @@ func getKeys(ctx *context.Context) (string, string) {
return "", ""
}
return obj.AccessKey, obj.SecretKey
return obj.AccessKey, obj.AccessSecret
}
}

View File

@ -85,12 +85,13 @@ func getUsernameByClientIdSecret(ctx *context.Context) string {
}
func getUsernameByKeys(ctx *context.Context) string {
accessKey, secretKey := getKeys(ctx)
accessKey, accessSecret := getKeys(ctx)
user, err := object.GetUserByAccessKey(accessKey)
if err != nil {
panic(err)
}
if user != nil && secretKey == user.SecretKey {
if user != nil && accessSecret == user.AccessSecret {
return user.GetId()
}
return ""