mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-01-01 02:56:34 +08:00
SSH登录支持Passphrase
This commit is contained in:
@@ -73,7 +73,7 @@ func (this *NodeGrantDAO) FindNodeGrantName(tx *dbs.Tx, id uint32) (string, erro
|
||||
}
|
||||
|
||||
// CreateGrant 创建认证信息
|
||||
func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, method string, username string, password string, privateKey string, description string, nodeId int64) (grantId int64, err error) {
|
||||
func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64) (grantId int64, err error) {
|
||||
op := NewNodeGrantOperator()
|
||||
op.AdminId = adminId
|
||||
op.Name = name
|
||||
@@ -87,6 +87,7 @@ func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, me
|
||||
case "privateKey":
|
||||
op.Username = username
|
||||
op.PrivateKey = privateKey
|
||||
op.Passphrase = passphrase
|
||||
}
|
||||
op.Description = description
|
||||
op.NodeId = nodeId
|
||||
@@ -96,7 +97,7 @@ func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, me
|
||||
}
|
||||
|
||||
// UpdateGrant 修改认证信息
|
||||
func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, method string, username string, password string, privateKey string, description string, nodeId int64) error {
|
||||
func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64) error {
|
||||
if grantId <= 0 {
|
||||
return errors.New("invalid grantId")
|
||||
}
|
||||
@@ -114,6 +115,7 @@ func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, me
|
||||
case "privateKey":
|
||||
op.Username = username
|
||||
op.PrivateKey = privateKey
|
||||
op.Passphrase = passphrase
|
||||
}
|
||||
op.Description = description
|
||||
op.NodeId = nodeId
|
||||
|
||||
@@ -9,7 +9,8 @@ type NodeGrant struct {
|
||||
Username string `field:"username"` // 用户名
|
||||
Password string `field:"password"` // 密码
|
||||
Su uint8 `field:"su"` // 是否需要su
|
||||
PrivateKey string `field:"privateKey"` // 密钥
|
||||
PrivateKey string `field:"privateKey"` // 私钥
|
||||
Passphrase string `field:"passphrase"` // 私钥密码
|
||||
Description string `field:"description"` // 备注
|
||||
NodeId uint32 `field:"nodeId"` // 专有节点
|
||||
Role string `field:"role"` // 角色
|
||||
@@ -25,7 +26,8 @@ type NodeGrantOperator struct {
|
||||
Username interface{} // 用户名
|
||||
Password interface{} // 密码
|
||||
Su interface{} // 是否需要su
|
||||
PrivateKey interface{} // 密钥
|
||||
PrivateKey interface{} // 私钥
|
||||
Passphrase interface{} // 私钥密码
|
||||
Description interface{} // 备注
|
||||
NodeId interface{} // 专有节点
|
||||
Role interface{} // 角色
|
||||
|
||||
Reference in New Issue
Block a user