feat: add access key and secret key for user (#1971)

This commit is contained in:
XDTD
2023-06-13 22:18:17 +08:00
committed by GitHub
parent 805cf20d04
commit 967fa4be68
9 changed files with 157 additions and 3 deletions

View File

@ -84,6 +84,18 @@ func getUsernameByClientIdSecret(ctx *context.Context) string {
return fmt.Sprintf("app/%s", application.Name)
}
func getUsernameByKeys(ctx *context.Context) string {
accessKey, secretKey := getKeys(ctx)
user, err := object.GetUserByAccessKey(accessKey)
if err != nil {
panic(err)
}
if user != nil && secretKey == user.SecretKey {
return user.GetId()
}
return ""
}
func getSessionUser(ctx *context.Context) string {
user := ctx.Input.CruSession.Get("username")
if user == nil {