~netlandish/gobwebs-oauth2

2e8c79b2113042347e89715ed005585e61f809d5 — Peter Sanchez 1 year, 6 months ago 8e1acb5
Adding token type
1 files changed, 6 insertions(+), 2 deletions(-)

M bearer.go
M bearer.go => bearer.go +6 -2
@@ 31,6 31,7 @@ func ToTimestamp(t time.Time) Timestamp {
// BearerToken ...
type BearerToken struct {
	Version  uint
	Type     string
	Issued   Timestamp
	Expires  Timestamp
	Grants   string


@@ 39,9 40,12 @@ type BearerToken struct {
}

// Encode ...
func (bt *BearerToken) Encode(ctx context.Context) string {
func (b *BearerToken) Encode(ctx context.Context) string {
	kw := crypto.KWForContext(ctx)
	plain, err := bare.Marshal(bt)
	if b.Type == "" {
		b.Type = "OAUTH2"
	}
	plain, err := bare.Marshal(b)
	if err != nil {
		panic(err)
	}