Skip to content

Commit

Permalink
Make copy of user object when removing groups
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Oct 5, 2021
1 parent 7e06084 commit 22611c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/grpc/services/gateway/authprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gateway.AuthenticateRequest
}, nil
}

u := res.User
u := *res.User
if sharedconf.SkipUserGroupsInToken() {
u.Groups = []string{}
}
Expand All @@ -109,7 +109,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gateway.AuthenticateRequest
// the resources referenced by these. Since the current scope can do that,
// mint a temporary token based on that and expand the scope. Then set the
// token obtained from the updated scope in the context.
token, err := s.tokenmgr.MintToken(ctx, u, res.TokenScope)
token, err := s.tokenmgr.MintToken(ctx, &u, res.TokenScope)
if err != nil {
err = errors.Wrap(err, "authsvc: error in MintToken")
res := &gateway.AuthenticateResponse{
Expand All @@ -129,7 +129,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gateway.AuthenticateRequest
}, nil
}

token, err = s.tokenmgr.MintToken(ctx, u, scope)
token, err = s.tokenmgr.MintToken(ctx, &u, scope)
if err != nil {
err = errors.Wrap(err, "authsvc: error in MintToken")
res := &gateway.AuthenticateResponse{
Expand Down

0 comments on commit 22611c0

Please sign in to comment.