jwt

package
v0.0.3-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthorizationHeaderRequired = errors.New("jwt/service: authorization header required")
	ErrInvalidToken                = errors.New("jwt/service: invalid token")
	ErrInvalidUserClaim            = errors.New("jwt/service: invalid user id claim")
	ErrInvalidEmailClaim           = errors.New("jwt/service: invalid email claim")
)
View Source
var (
	ErrInvalidSignatureAlgorithm = errors.New("jwt: invalid signature algorithm")
)

Functions

func ParseAlgorithm

func ParseAlgorithm(keyAttrs *keystore.KeyAttributes) (string, error)

Types

type JsonWebTokenClaims

type JsonWebTokenClaims struct {
	// Email          string
	Organizations  []uint64 `json:"orgs"`
	Services       []uint64 `json:"svcs"`
	UserID         uint64   `json:"uid"`
	WebAuthnClaims *webauthn.SessionData
	jwt.RegisteredClaims
}

type Service

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

func NewService

func NewService(config *config.WebService,
	keyring *platform.Keyring,
	keyAttrs *keystore.KeyAttributes) (*Service, error)

func (*Service) GenerateToken

func (service *Service) GenerateToken(user *entities.User) (string, error)

func (*Service) KeyFunc

func (service *Service) KeyFunc(token *jwt.Token) (interface{}, error)

func (*Service) ParseToken

func (service *Service) ParseToken(
	w http.ResponseWriter, r *http.Request) (*jwt.Token, *JsonWebTokenClaims, error)

func (*Service) ParseTokenString

func (service *Service) ParseTokenString(tokenString string) (*jwt.Token, error)

func (*Service) PublicKey

func (service *Service) PublicKey() crypto.PublicKey

func (*Service) Verify

func (service *Service) Verify(token *jwt.Token) error

type SigningMethod

type SigningMethod struct {
	jwt.SigningMethod
	// contains filtered or unexported fields
}

func NewSigningMethod

func NewSigningMethod(keyAttrs *keystore.KeyAttributes) (*SigningMethod, error)

func (*SigningMethod) Alg

func (sm *SigningMethod) Alg() string

func (*SigningMethod) Digest

func (sm *SigningMethod) Digest(signingString string) ([]byte, error)

func (*SigningMethod) Sign

func (sm *SigningMethod) Sign(signingString string, key interface{}) ([]byte, error)

func (*SigningMethod) Verify

func (sm *SigningMethod) Verify(signingString string, signature []byte, key interface{}) error

Jump to

Keyboard shortcuts

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