Skip to content

Commit

Permalink
Merge pull request #124 from tzvatot/exp-missing
Browse files Browse the repository at this point in the history
Assume expiration is 0 when missing in the token claim
  • Loading branch information
Irit Goihman authored Aug 19, 2020
2 parents e9de38d + 06bf804 commit efb47e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This document describes the relevant changes between releases of the
`ocm` command line tool.

== 0.1.41 Aug 19 2020

- Assume expiration is 0 when missing 'exp' claim in the jwt token.

== 0.1.40 Aug 19 2020

- Add Product ID field to list/describe clusters.
Expand Down
15 changes: 7 additions & 8 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,14 @@ func tokenExpiry(text string, now time.Time) (expires bool, left time.Duration,
err = fmt.Errorf("expected map claims bug got %T", claims)
return
}
var exp float64
claim, ok := claims["exp"]
if !ok {
err = fmt.Errorf("token doesn't contain the 'exp' claim")
return
}
exp, ok := claim.(float64)
if !ok {
err = fmt.Errorf("expected floating point 'exp' but got %T", claim)
return
if ok {
exp, ok = claim.(float64)
if !ok {
err = fmt.Errorf("expected floating point 'exp' but got %T", claim)
return
}
}
if exp == 0 {
expires = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ limitations under the License.

package info

const Version = "0.1.40"
const Version = "0.1.41"

0 comments on commit efb47e1

Please sign in to comment.