mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 14:50:55 +01:00
a random token will work better
This commit is contained in:
parent
4792aa0064
commit
575a3f7030
@ -31,7 +31,12 @@ func (h *enableHandler) Handle(params environment.EnableParams, principal *rest_
|
|||||||
logrus.Errorf("error getting edge client: %v", err)
|
logrus.Errorf("error getting edge client: %v", err)
|
||||||
return environment.NewEnableInternalServerError()
|
return environment.NewEnableInternalServerError()
|
||||||
}
|
}
|
||||||
ident, err := zrokEdgeSdk.CreateEnvironmentIdentity(principal.Token, principal.Email, params.Body.Description, client)
|
uniqueToken, err := createShareToken()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error creating unique identity token: %v", err)
|
||||||
|
return environment.NewEnableInternalServerError()
|
||||||
|
}
|
||||||
|
ident, err := zrokEdgeSdk.CreateEnvironmentIdentity(uniqueToken, principal.Email, params.Body.Description, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return environment.NewEnableInternalServerError()
|
return environment.NewEnableInternalServerError()
|
||||||
|
@ -12,10 +12,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateEnvironmentIdentity(secretToken, accountEmail, envDescription string, edge *rest_management_api_client.ZitiEdgeManagement) (*identity.CreateIdentityCreated, error) {
|
func CreateEnvironmentIdentity(uniqueToken, accountEmail, envDescription string, edge *rest_management_api_client.ZitiEdgeManagement) (*identity.CreateIdentityCreated, error) {
|
||||||
identityType := rest_model_edge.IdentityTypeUser
|
identityType := rest_model_edge.IdentityTypeUser
|
||||||
moreTags := map[string]interface{}{"zrokEmail": accountEmail}
|
moreTags := map[string]interface{}{"zrokEmail": accountEmail}
|
||||||
return CreateIdentity(accountEmail+"-"+secretToken+"-"+envDescription, identityType, moreTags, edge)
|
return CreateIdentity(accountEmail+"-"+uniqueToken+"-"+envDescription, identityType, moreTags, edge)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateIdentity(name string, identityType rest_model_edge.IdentityType, addlTags map[string]interface{}, edge *rest_management_api_client.ZitiEdgeManagement) (*identity.CreateIdentityCreated, error) {
|
func CreateIdentity(name string, identityType rest_model_edge.IdentityType, addlTags map[string]interface{}, edge *rest_management_api_client.ZitiEdgeManagement) (*identity.CreateIdentityCreated, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user