Skip to content

Commit

Permalink
Create only available fields in token
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Nov 29, 2023
1 parent 2c47ab7 commit 92f2f34
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions http/handler/api/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ func (s *SessionHandler) CreateToken(c echo.Context) error {
}

for i, req := range request {
data := map[string]interface{}{
"match": req.Match,
"remote": req.Remote,
"extra": req.Extra,
data := map[string]interface{}{}

if len(req.Match) != 0 {
data["match"] = req.Match
}

if len(req.Remote) != 0 {
data["remote"] = req.Remote
}

if len(req.Extra) != 0 {
data["extra"] = req.Extra
}

request[i].Token = identity.GetServiceSession(data, time.Duration(req.TTL)*time.Second)
Expand Down

0 comments on commit 92f2f34

Please sign in to comment.