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

@ -79,7 +79,7 @@ type User struct {
PreHash string `xorm:"varchar(100)" json:"preHash"` PreHash string `xorm:"varchar(100)" json:"preHash"`
Groups []string `xorm:"varchar(1000)" json:"groups"` Groups []string `xorm:"varchar(1000)" json:"groups"`
AccessKey string `xorm:"varchar(100)" json:"accessKey"` AccessKey string `xorm:"varchar(100)" json:"accessKey"`
SecretKey string `xorm:"varchar(100)" json:"secretKey"` AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
CreatedIp string `xorm:"varchar(100)" json:"createdIp"` CreatedIp string `xorm:"varchar(100)" json:"createdIp"`
LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"` LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"`
@ -508,7 +508,7 @@ func UpdateUser(id string, user *User, columns []string, isAdmin bool) (bool, er
"owner", "display_name", "avatar", "owner", "display_name", "avatar",
"location", "address", "country_code", "region", "language", "affiliation", "title", "homepage", "bio", "tag", "language", "gender", "birthday", "education", "score", "karma", "ranking", "signup_application", "location", "address", "country_code", "region", "language", "affiliation", "title", "homepage", "bio", "tag", "language", "gender", "birthday", "education", "score", "karma", "ranking", "signup_application",
"is_admin", "is_global_admin", "is_forbidden", "is_deleted", "hash", "is_default_avatar", "properties", "webauthnCredentials", "managedAccounts", "is_admin", "is_global_admin", "is_forbidden", "is_deleted", "hash", "is_default_avatar", "properties", "webauthnCredentials", "managedAccounts",
"signin_wrong_times", "last_signin_wrong_time", "groups", "access_key", "secret_key", "signin_wrong_times", "last_signin_wrong_time", "groups", "access_key", "access_secret",
"github", "google", "qq", "wechat", "facebook", "dingtalk", "weibo", "gitee", "linkedin", "wecom", "lark", "gitlab", "adfs", "github", "google", "qq", "wechat", "facebook", "dingtalk", "weibo", "gitee", "linkedin", "wecom", "lark", "gitlab", "adfs",
"baidu", "alipay", "casdoor", "infoflow", "apple", "azuread", "slack", "steam", "bilibili", "okta", "douyin", "line", "amazon", "baidu", "alipay", "casdoor", "infoflow", "apple", "azuread", "slack", "steam", "bilibili", "okta", "douyin", "line", "amazon",
"auth0", "battlenet", "bitbucket", "box", "cloudfoundry", "dailymotion", "deezer", "digitalocean", "discord", "dropbox", "auth0", "battlenet", "bitbucket", "box", "cloudfoundry", "dailymotion", "deezer", "digitalocean", "discord", "dropbox",
@ -922,7 +922,7 @@ func AddUserkeys(user *User, isAdmin bool) (bool, error) {
} }
user.AccessKey = util.GenerateId() user.AccessKey = util.GenerateId()
user.SecretKey = util.GenerateId() user.AccessSecret = util.GenerateId()
return UpdateUser(user.GetId(), user, []string{}, isAdmin) return UpdateUser(user.GetId(), user, []string{}, isAdmin)
} }

View File

@ -26,10 +26,10 @@ import (
) )
type Object struct { type Object struct {
Owner string `json:"owner"` Owner string `json:"owner"`
Name string `json:"name"` Name string `json:"name"`
AccessKey string `json:"accessKey"` AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"` AccessSecret string `json:"accessSecret"`
} }
func getUsername(ctx *context.Context) (username string) { func getUsername(ctx *context.Context) (username string) {
@ -107,14 +107,14 @@ func getKeys(ctx *context.Context) (string, string) {
method := ctx.Request.Method method := ctx.Request.Method
if method == http.MethodGet { if method == http.MethodGet {
accessKey := ctx.Input.Query("accesskey") accessKey := ctx.Input.Query("accessKey")
secretKey := ctx.Input.Query("secretkey") accessSecret := ctx.Input.Query("accessSecret")
return accessKey, secretKey return accessKey, accessSecret
} else { } else {
body := ctx.Input.RequestBody body := ctx.Input.RequestBody
if len(body) == 0 { 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 var obj Object
@ -123,7 +123,7 @@ func getKeys(ctx *context.Context) (string, string) {
return "", "" 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 { func getUsernameByKeys(ctx *context.Context) string {
accessKey, secretKey := getKeys(ctx) accessKey, accessSecret := getKeys(ctx)
user, err := object.GetUserByAccessKey(accessKey) user, err := object.GetUserByAccessKey(accessKey)
if err != nil { if err != nil {
panic(err) panic(err)
} }
if user != nil && secretKey == user.SecretKey {
if user != nil && accessSecret == user.AccessSecret {
return user.GetId() return user.GetId()
} }
return "" return ""

View File

@ -724,10 +724,10 @@ class UserEditPage extends React.Component {
</Row> </Row>
<Row style={{marginTop: "20px"}} > <Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 1}> <Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 1}>
{Setting.getLabel(i18next.t("general:Secret key"), i18next.t("general:Secret key - Tooltip"))} : {Setting.getLabel(i18next.t("general:Access secret"), i18next.t("general:Access secret - Tooltip"))} :
</Col> </Col>
<Col span={22} > <Col span={22} >
<Input value={this.state.user.secretKey} disabled={true} /> <Input value={this.state.user.accessSecret} disabled={true} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: "20px"}} > <Row style={{marginTop: "20px"}} >

View File

@ -162,6 +162,12 @@
"Verify": "überprüfen" "Verify": "überprüfen"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Aktion", "Action": "Aktion",
"Adapter": "Adapter", "Adapter": "Adapter",
"Adapter - Tooltip": "Tabellenname des Policy Stores", "Adapter - Tooltip": "Tabellenname des Policy Stores",

View File

@ -162,6 +162,12 @@
"Verify": "Verify" "Verify": "Verify"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Action", "Action": "Action",
"Adapter": "Adapter", "Adapter": "Adapter",
"Adapter - Tooltip": "Table name of the policy store", "Adapter - Tooltip": "Table name of the policy store",

View File

@ -162,6 +162,12 @@
"Verify": "Verificar" "Verify": "Verificar"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Acción", "Action": "Acción",
"Adapter": "Adaptador", "Adapter": "Adaptador",
"Adapter - Tooltip": "Nombre de la tabla de la tienda de políticas", "Adapter - Tooltip": "Nombre de la tabla de la tienda de políticas",

View File

@ -162,6 +162,12 @@
"Verify": "Vérifier" "Verify": "Vérifier"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Action", "Action": "Action",
"Adapter": "S'adapter", "Adapter": "S'adapter",
"Adapter - Tooltip": "Nom de la table du magasin de politique", "Adapter - Tooltip": "Nom de la table du magasin de politique",

View File

@ -162,6 +162,12 @@
"Verify": "Memverifikasi" "Verify": "Memverifikasi"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Aksi", "Action": "Aksi",
"Adapter": "Adapter", "Adapter": "Adapter",
"Adapter - Tooltip": "Nama tabel dari penyimpanan kebijakan", "Adapter - Tooltip": "Nama tabel dari penyimpanan kebijakan",

View File

@ -162,6 +162,12 @@
"Verify": "検証" "Verify": "検証"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "アクション", "Action": "アクション",
"Adapter": "アダプター", "Adapter": "アダプター",
"Adapter - Tooltip": "ポリシー・ストアのテーブル名", "Adapter - Tooltip": "ポリシー・ストアのテーブル名",

View File

@ -162,6 +162,12 @@
"Verify": "검증하다" "Verify": "검증하다"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "동작", "Action": "동작",
"Adapter": "어댑터", "Adapter": "어댑터",
"Adapter - Tooltip": "정책 저장소의 테이블 이름", "Adapter - Tooltip": "정책 저장소의 테이블 이름",

View File

@ -162,6 +162,12 @@
"Verify": "Verificar" "Verify": "Verificar"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Ação", "Action": "Ação",
"Adapter": "Adaptador", "Adapter": "Adaptador",
"Adapter - Tooltip": "Nome da tabela do armazenamento de políticas", "Adapter - Tooltip": "Nome da tabela do armazenamento de políticas",

View File

@ -162,6 +162,12 @@
"Verify": "Проверить" "Verify": "Проверить"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Действие", "Action": "Действие",
"Adapter": "Адаптер", "Adapter": "Адаптер",
"Adapter - Tooltip": "Имя таблицы хранилища политик", "Adapter - Tooltip": "Имя таблицы хранилища политик",

View File

@ -162,6 +162,12 @@
"Verify": "Xác thực" "Verify": "Xác thực"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "Hành động", "Action": "Hành động",
"Adapter": "Bộ chuyển đổi", "Adapter": "Bộ chuyển đổi",
"Adapter - Tooltip": "Tên bảng của kho lưu trữ chính sách", "Adapter - Tooltip": "Tên bảng của kho lưu trữ chính sách",

View File

@ -162,6 +162,12 @@
"Verify": "验证" "Verify": "验证"
}, },
"general": { "general": {
"API key": "API key",
"API key - Tooltip": "API key - Tooltip",
"Access key": "Access key",
"Access key - Tooltip": "Access key - Tooltip",
"Access secret": "Access secret",
"Access secret - Tooltip": "Access secret - Tooltip",
"Action": "操作", "Action": "操作",
"Adapter": "适配器", "Adapter": "适配器",
"Adapter - Tooltip": "策略存储的表名", "Adapter - Tooltip": "策略存储的表名",