Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadRSAPEMKeysFromDir ¶
LoadRSAPEMKeysFromDir loads RSA PEM keys from the given directory.
Types ¶
type RSA256RoundRobinTokenizer ¶
type RSA256RoundRobinTokenizer struct {
// contains filtered or unexported fields
}
RSA256RoundRobinTokenizer is a tokenizer that uses RSA256 as the hashing algorithm. The tokenizer uses a round-robin algorithm to select the key to use.
func NewRSA256RoundRobinTokenizer ¶
func NewRSA256RoundRobinTokenizer(keys map[string]*rsa.PrivateKey) *RSA256RoundRobinTokenizer
NewRSA256RoundRobinTokenizer creates a new RSA256RoundRobinTokenizer.
func (*RSA256RoundRobinTokenizer) Detokenize ¶
func (t *RSA256RoundRobinTokenizer) Detokenize(token string, claims jwt.Claims) error
func (*RSA256RoundRobinTokenizer) Tokenize ¶
func (t *RSA256RoundRobinTokenizer) Tokenize(claims jwt.Claims) (string, error)
type SHA256Tokenizer ¶
type SHA256Tokenizer string
SHA256Tokenizer is a tokenizer that uses SHA256 as the hashing algorithm. This Tokenizer using its value as the secret key. For example,
var myTokenizer = SHA256Tokenizer("my-secret-key") // using `my-secret-key` as the secret key.
func (SHA256Tokenizer) Detokenize ¶
func (t SHA256Tokenizer) Detokenize(token string, claims jwt.Claims) error
func (SHA256Tokenizer) Tokenize ¶
func (t SHA256Tokenizer) Tokenize(claims jwt.Claims) (string, error)
type Tokenizer ¶
type Tokenizer interface { // Tokenize creates a token from the given claims. Tokenize(claims jwt.Claims) (token string, err error) // Detokenize validates the given token and returns the claims. Detokenize(token string, claims jwt.Claims) error }
Tokenizer knows how to create and validate jwtx.
Click to show internal directories.
Click to hide internal directories.