jwt

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 9 Imported by: 0

README

jwt

This package contains helper methods to parse or generate JWT authorization header.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	*rsa.PrivateKey
	*rsa.PublicKey
}

func NewKeyPair

func NewKeyPair() *KeyPair

func (*KeyPair) SetString

func (kp *KeyPair) SetString(input string) (err error)

func (KeyPair) String

func (kp KeyPair) String() string

type Session

type Session struct {
	Keys    *KeyPair
	Options *SessionOptions
}

func NewSession

func NewSession(options *SessionOptions) *Session

func (Session) GenerateAuthorization

func (s Session) GenerateAuthorization(userId, sessionId string) (string, error)

func (Session) MustParse added in v1.1.0

func (s Session) MustParse(token string) map[string]interface{}

func (Session) MustSign added in v1.1.0

func (s Session) MustSign(claims map[string]interface{}) string

func (Session) Parse added in v1.1.0

func (s Session) Parse(tokenString string) (map[string]interface{}, error)

func (Session) ParseAuthorization

func (s Session) ParseAuthorization(auth string) (userId, sessionId string, ok bool)

func (*Session) SetString

func (s *Session) SetString(input string) (err error)

func (Session) Sign added in v1.1.0

func (s Session) Sign(claims map[string]interface{}) (string, error)

func (Session) String

func (s Session) String() string

type SessionOptions

type SessionOptions struct {
	UserIdKeyName    string // defaults to "UserId"
	SessionIdKeyName string // defaults to "SessionId"
}

Jump to

Keyboard shortcuts

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