diff --git a/internal/services/configstore/action/project.go b/internal/services/configstore/action/project.go index 1efba56..0c3e900 100644 --- a/internal/services/configstore/action/project.go +++ b/internal/services/configstore/action/project.go @@ -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 { diff --git a/internal/services/configstore/action/user.go b/internal/services/configstore/action/user.go index dc030cb..0b0a80e 100644 --- a/internal/services/configstore/action/user.go +++ b/internal/services/configstore/action/user.go @@ -89,8 +89,9 @@ func (h *ActionHandler) CreateUser(ctx context.Context, req *CreateUserRequest) } user := &types.User{ - ID: uuid.NewV4().String(), - Name: req.UserName, + ID: uuid.NewV4().String(), + Name: req.UserName, + Secret: util.EncodeSha1Hex(uuid.NewV4().String()), } if req.CreateUserLARequest != nil { if user.LinkedAccounts == nil { diff --git a/internal/services/types/types.go b/internal/services/types/types.go index f5da0b8..9da6d3d 100644 --- a/internal/services/types/types.go +++ b/internal/services/types/types.go @@ -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"`