Skip to content

Commit

Permalink
Added a field to the user JWT that disables nonce verification when set.
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Dec 17, 2019
1 parent 0c3fc7a commit 93cf21b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/nats-io/jwt

require github.com/nats-io/nkeys v0.1.3

go 1.13
7 changes: 7 additions & 0 deletions user_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type UserClaims struct {
// IssuerAccount stores the public key for the account the issuer represents.
// When set, the claim was issued by a signing key.
IssuerAccount string `json:"issuer_account,omitempty"`
// When BearerToken is true server will ignore any nonce-signing verification
BearerToken bool `json:"bearer_token,omitempty"`
}

// NewUserClaims creates a user JWT with the specific subject/public key
Expand Down Expand Up @@ -97,3 +99,8 @@ func (u *UserClaims) Payload() interface{} {
func (u *UserClaims) String() string {
return u.ClaimsData.String(u)
}

// IsBearerToken returns true if nonce-signing requirements should be skipped
func (u *UserClaims) IsBearerToken() bool {
return u.BearerToken
}

0 comments on commit 93cf21b

Please sign in to comment.