configstore: generate User and Project secret
This commit is contained in:
parent
4154be3370
commit
2675aee333
|
@ -133,6 +133,7 @@ func (h *ActionHandler) CreateProject(ctx context.Context, project *types.Projec
|
|||
|
||||
project.ID = uuid.NewV4().String()
|
||||
project.Parent.Type = types.ConfigTypeProjectGroup
|
||||
project.Secret = util.EncodeSha1Hex(uuid.NewV4().String())
|
||||
|
||||
pcj, err := json.Marshal(project)
|
||||
if err != nil {
|
||||
|
|
|
@ -91,6 +91,7 @@ func (h *ActionHandler) CreateUser(ctx context.Context, req *CreateUserRequest)
|
|||
user := &types.User{
|
||||
ID: uuid.NewV4().String(),
|
||||
Name: req.UserName,
|
||||
Secret: util.EncodeSha1Hex(uuid.NewV4().String()),
|
||||
}
|
||||
if req.CreateUserLARequest != nil {
|
||||
if user.LinkedAccounts == nil {
|
||||
|
|
|
@ -73,6 +73,9 @@ type User struct {
|
|||
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// A secret string that could be used for signing or other purposes
|
||||
Secret string `json:"secret,omitempty"`
|
||||
|
||||
LinkedAccounts map[string]*LinkedAccount `json:"linked_accounts,omitempty"`
|
||||
|
||||
// Optional local auth
|
||||
|
@ -233,6 +236,9 @@ type Project struct {
|
|||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// A secret string that could be used for signing or other purposes
|
||||
Secret string `json:"secret,omitempty"`
|
||||
|
||||
Parent Parent `json:"parent,omitempty"`
|
||||
|
||||
Visibility Visibility `json:"visibility,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue