Update go dependencies

This commit is contained in:
Manuel de Brito Fontes 2018-09-22 14:54:24 -03:00
parent 55ccaf4be3
commit 2882fb5ebe
457 changed files with 54614 additions and 19833 deletions

View file

@ -18,9 +18,10 @@
package jwt
import (
"encoding/json"
"strconv"
"time"
"gopkg.in/square/go-jose.v2/json"
)
// Claims represents public claim values (as specified in RFC 7519).

View file

@ -18,6 +18,7 @@
package jwt
import (
"fmt"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/json"
"strings"
@ -25,8 +26,9 @@ import (
// JSONWebToken represents a JSON Web Token (as specified in RFC7519).
type JSONWebToken struct {
payload func(k interface{}) ([]byte, error)
Headers []jose.Header
payload func(k interface{}) ([]byte, error)
unverifiedPayload func() []byte
Headers []jose.Header
}
type NestedJSONWebToken struct {
@ -50,6 +52,22 @@ func (t *JSONWebToken) Claims(key interface{}, dest ...interface{}) error {
return nil
}
// UnsafeClaimsWithoutVerification deserializes the claims of a
// JSONWebToken into the dests. For signed JWTs, the claims are not
// verified. This function won't work for encrypted JWTs.
func (t *JSONWebToken) UnsafeClaimsWithoutVerification(dest ...interface{}) error {
if t.unverifiedPayload == nil {
return fmt.Errorf("square/go-jose: Cannot get unverified claims")
}
claims := t.unverifiedPayload()
for _, d := range dest {
if err := json.Unmarshal(claims, d); err != nil {
return err
}
}
return nil
}
func (t *NestedJSONWebToken) Decrypt(decryptionKey interface{}) (*JSONWebToken, error) {
b, err := t.enc.Decrypt(decryptionKey)
if err != nil {
@ -76,8 +94,9 @@ func ParseSigned(s string) (*JSONWebToken, error) {
}
return &JSONWebToken{
payload: sig.Verify,
Headers: headers,
payload: sig.Verify,
unverifiedPayload: sig.UnsafePayloadWithoutVerification,
Headers: headers,
}, nil
}

View file

@ -35,7 +35,7 @@ type Expected struct {
Audience Audience
// ID matches the "jti" claim exactly.
ID string
// Time matches the "exp" and "ebf" claims with leeway.
// Time matches the "exp" and "nbf" claims with leeway.
Time time.Time
}