jwt

package module
v0.0.0-...-c940222 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Unlicense Imports: 12 Imported by: 0

README

JWT

JWT library for Go

Implemented standards and best practice

Standart Implemented Notes
JSON Web Signature (JWS) Yes
JSON Web Encryption (JWE) No
JSON Web Key (JWK) Yes
JSON Web Algorithms (JWA) Partly Only parts applicable to JWS

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultVerificationConfig = verificationConfig{
	// contains filtered or unexported fields
}

Functions

func WithAudience

func WithAudience(audience string) func(*Token) error

func WithExpirationTime

func WithExpirationTime(expirationTime *time.Time) func(*Token) error

func WithId

func WithId(id string) func(*Token) error

func WithIssuedAt

func WithIssuedAt(issuedAt *time.Time) func(*Token) error

func WithIssuer

func WithIssuer(issuer string) func(*Token) error

func WithNotBefore

func WithNotBefore(notBefore *time.Time) func(*Token) error

func WithPrivateClaim

func WithPrivateClaim(key string, value any) func(*Token) error

func WithSignature

func WithSignature(algorithm jwa.Signer, key *jwk.Key, options ...func(*jws.Signature)) func(*Token) error

func WithSubject

func WithSubject(subject string) func(*Token) error

Types

type Token

type Token struct {
	// contains filtered or unexported fields
}

func NewToken

func NewToken(options ...func(*Token) error) (*Token, error)

func Unmarshal

func Unmarshal(token string) (*Token, error)

func (*Token) Audience

func (token *Token) Audience() string

func (*Token) ExpirationTime

func (token *Token) ExpirationTime() *time.Time

func (*Token) Id

func (token *Token) Id() string

func (*Token) IssuedAt

func (token *Token) IssuedAt() *time.Time

func (*Token) Issuer

func (token *Token) Issuer() string

func (*Token) MarshalJSON

func (token *Token) MarshalJSON() ([]byte, error)

func (*Token) NotBefore

func (token *Token) NotBefore() *time.Time

func (*Token) PrivateClaim

func (token *Token) PrivateClaim(key string) any

func (*Token) String

func (token *Token) String() string

func (*Token) Subject

func (token *Token) Subject() string

func (*Token) UnmarshalJSON

func (token *Token) UnmarshalJSON(data []byte) error

func (*Token) Verify

func (token *Token) Verify(keySet *jwk.KeySet, config verificationConfig) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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