token

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken added in v0.4.6

type AccessToken struct {
	Issuer        string    `json:"iss"`
	Audience      string    `json:"aud"`
	Expiry        time.Time `json:"exp"`
	IssuedAt      time.Time `json:"iat"`
	Email         string    `json:"email"`
	Name          string    `json:"name"`
	IsSystemAdmin bool      `json:"is_system_admin"`
}

type RefreshToken added in v0.4.6

type RefreshToken struct {
	Email    string    `json:"email"`
	Expiry   time.Time `json:"exp"`
	IssuedAt time.Time `json:"iat"`
}

type Signer

type Signer interface {
	SignAccessToken(*AccessToken) (string, error)
	SignRefreshToken(*RefreshToken) (string, error)
}

func NewSigner

func NewSigner(keyPath string) (Signer, error)

func NewSignerWithPrivateKey

func NewSignerWithPrivateKey(privateKey *rsa.PrivateKey) (Signer, error)

type Verifier

type Verifier interface {
	VerifyAccessToken(string) (*AccessToken, error)
	VerifyRefreshToken(string) (*RefreshToken, error)
}

func NewVerifier

func NewVerifier(keyPath, issuer, audience string) (Verifier, error)

Jump to

Keyboard shortcuts

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