accesstoken

package
v0.0.0-...-45e1d17 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpiredToken    = errors.New("expired token")
	ErrInvalidAudience = errors.New("invalid audience")
	ErrInvalidIssuer   = errors.New("invalid issuer")
)

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Issuer         string   `json:"iss"`
	ExpirationTime int64    `json:"exp"`
	Audience       Audience `json:"aud"`
	Subject        string   `json:"sub"`
	IssuedAt       int64    `json:"iat"`
}

func ParseAccessToken

func ParseAccessToken(accessToken string, issuer string, audience string, secretKey []byte) (*AccessToken, error)

func (*AccessToken) Sign

func (a *AccessToken) Sign(secretKey []byte) (string, error)

func (*AccessToken) Valid

func (a *AccessToken) Valid() error

type Audience

type Audience []string

func (*Audience) MarshalJSON

func (aud *Audience) MarshalJSON() ([]byte, error)

func (*Audience) UnmarshalJSON

func (aud *Audience) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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