Skip to content

Commit

Permalink
removed token issues
Browse files Browse the repository at this point in the history
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
  • Loading branch information
Saranya-jena committed Jul 5, 2024
1 parent b72fb54 commit 39b774d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chaoscenter/graphql/server/graph/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package graph

import (
"context"
"fmt"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/authConfig"

chaos_experiment2 "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaos_experiment/ops"
Expand Down Expand Up @@ -93,6 +94,8 @@ func NewConfig(mongodbOperator mongodb.MongoOperator) generated.Config {
if err != nil {
return nil, err
}

fmt.Println("here2")
newCtx := context.WithValue(ctx, authorization.UserClaim, user)
newCtx = context.WithValue(newCtx, "username", user["username"])

Expand Down
2 changes: 2 additions & 0 deletions chaoscenter/graphql/server/pkg/authorization/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package authorization

import (
"context"
"fmt"
"net/http"
"strings"

Expand Down Expand Up @@ -38,6 +39,7 @@ func Middleware(handler http.Handler, mongoClient *mongo.Client) gin.HandlerFunc
ctx := context.WithValue(c.Request.Context(), AuthKey, jwt)
ctx1 := context.WithValue(ctx, "request-header", c.Request.Header)
c.Request = c.Request.WithContext(ctx1)
fmt.Println("here1")
handler.ServeHTTP(c.Writer, c.Request)
}
}
Expand Down

0 comments on commit 39b774d

Please sign in to comment.