Skip to content

Commit

Permalink
fix: formatting int issue
Browse files Browse the repository at this point in the history
  • Loading branch information
blairdrummond committed Nov 21, 2024
1 parent 0957553 commit 6c038a5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions connector/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,52 @@ func (c *oidcConnector) ExtendPayload(scopes []string, payload []byte, cdata []b
return nil, fmt.Errorf("denied")
}

// these need to be floats, not json.Numbers
for _, key := range []string{"iat", "exp", "nbf"} {
if _, ok := r.Token[key]; ok {
if vv, ok := claims[key]; ok {
r.Token[key] = vv
} else {
delete(r.Token, key)
}
}
}

output, err := json.Marshal(&r.Token)

return output, err
}

//type jsonTime time.Time

Check failure on line 700 in connector/oidc/oidc.go

View workflow job for this annotation

GitHub Actions / Lint

commentFormatting: put a space between `//` and comment text (gocritic)
//
//type tokenTimes struct {
// Iat jsonTime `json:"iat"`
// Exp jsonTime `json:"exp"`
// Nbf jsonTime `json:"nbf"`
//}
//
//func (j *jsonTime) MarshalJSON() ([]byte, error) {
// t := time.Time(*j)
// return json.Marshal(t.Unix())
//}
//
//func (j *jsonTime) UnmarshalJSON(b []byte) error {
// var n json.Number
// if err := json.Unmarshal(b, &n); err != nil {
// return err
// }
// var unix int64
//
// if t, err := n.Int64(); err == nil {
// unix = t
// } else {
// f, err := n.Float64()
// if err != nil {
// return err
// }
// unix = int64(f)
// }
// *j = jsonTime(time.Unix(unix, 0))
// return nil
//}
//

0 comments on commit 6c038a5

Please sign in to comment.