From da4b15761dd62a4bbe45bf65e0d934701a6bedaf Mon Sep 17 00:00:00 2001 From: djelusic Date: Mon, 28 Feb 2022 18:01:15 +0100 Subject: [PATCH] remove automatic token creation --- cli/controller/setup.go | 3 --- node/api/setup/setup.go | 15 --------------- node/dto/dto.go | 1 - 3 files changed, 19 deletions(-) diff --git a/cli/controller/setup.go b/cli/controller/setup.go index fd4b91e..c8ad053 100644 --- a/cli/controller/setup.go +++ b/cli/controller/setup.go @@ -144,9 +144,6 @@ func (c *Setup) create(n *domain.Node) error { } n.Endpoints.Rest = rsp.APIGatewayRestURL n.CliRole = rsp.CliRole - if n.GitHubAuthEnabled { - n.JWT = rsp.JWT - } infrastructureDuration := tmr() log.Event(domain.Event{NodeCreate: &domain.NodeEvent{ diff --git a/node/api/setup/setup.go b/node/api/setup/setup.go index b05088b..3a669e6 100644 --- a/node/api/setup/setup.go +++ b/node/api/setup/setup.go @@ -4,9 +4,7 @@ import ( "context" "errors" "fmt" - "time" - "github.com/mantil-io/mantil/domain" "github.com/mantil-io/mantil/kit/aws" "github.com/mantil-io/mantil/kit/token" "github.com/mantil-io/mantil/node/dto" @@ -141,25 +139,12 @@ func (s *Setup) terraformCreate(req *dto.SetupRequest) (*dto.SetupResponse, erro if err != nil { return nil, err } - jwt, err := s.generateJWT(privateKey) - if err != nil { - return nil, err - } return &dto.SetupResponse{ APIGatewayRestURL: url, CliRole: cliRole, - JWT: jwt, }, nil } -func (s *Setup) generateJWT(privateKey string) (string, error) { - claims := &domain.AccessTokenClaims{ - Username: "user", - Role: domain.Owner, - } - return token.JWT(privateKey, claims, 7*24*time.Hour) -} - func (s *Setup) terraformDestroy(req *dto.SetupDestroyRequest) error { data := terraform.SetupTemplateData{ Bucket: req.Bucket, diff --git a/node/dto/dto.go b/node/dto/dto.go index 6cab39b..f3dff0b 100644 --- a/node/dto/dto.go +++ b/node/dto/dto.go @@ -118,5 +118,4 @@ type SetupDestroyRequest struct { type SetupResponse struct { APIGatewayRestURL string CliRole string - JWT string }