jwt

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

jwtvalidate

This is a small helper library which validates JWT tokens in concert with my fork of go-iodc.

GitHub Actions status Go Report Card Documentation

License

This code is released under the Apache 2.0 license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitScopes

func SplitScopes(scope string) []string

SplitScopes simple helper to split and return scopes as an array

Types

type JSONTime

type JSONTime time.Time

JSONTime represents a time which has been parsed from a epoch seconds

func (*JSONTime) Time

func (j *JSONTime) Time() time.Time

Time returns the time value

func (*JSONTime) UnmarshalJSON

func (j *JSONTime) UnmarshalJSON(b []byte) error

UnmarshalJSON parse the epoch unix time

type Payload added in v1.1.0

type Payload struct {
	Sub      string   `json:"sub"`
	TokenUse string   `json:"token_use"`
	Scope    string   `json:"scope"`
	AuthTime JSONTime `json:"auth_time"`
	Issuer   string   `json:"iss"`
	Expires  JSONTime `json:"exp"`
	IssuedAt JSONTime `json:"iat"`
	Version  int      `json:"version"`
	Jti      string   `json:"jti"`
	ClientID string   `json:"client_id"`
}

Payload base JWT payload

func Validate

func Validate(ctx context.Context, providerURL, token string) (*Payload, error)

Validate returns validates the token, then returns just the parsed JSON from the JWT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL