jwt

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

jwt allows the easy programmatic creation of jwt signing-keys and tokens, mainly for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(signer jose.Signer, cl jwt.Claims, privateClaims ...interface{}) (string, error)

CreateToken creates a jwt token with the given claims

func CreateWebkeyPair

func CreateWebkeyPair(alg jose.SignatureAlgorithm, use string) (jose.JSONWebKey, jose.JSONWebKey, error)

CreateWebkeyPair creates a JSONWebKey-Pair. alg is one of jose signature-algorithm constants, e.g. jose.RS256. use is "sig" for signature or "enc" for encryption, see https://tools.ietf.org/html/rfc7517#page-6

func GenerateSigningKey

func GenerateSigningKey(alg jose.SignatureAlgorithm, bits int) (crypto.PublicKey, crypto.PrivateKey, error)

GenerateSigningKey generates a keypair for corresponding SignatureAlgorithm.

func GenerateToken

func GenerateToken(tenant string, grps []string, issuedAt, expiresAt time.Time) (string, error)

func MustMakeSigner

func MustMakeSigner(alg jose.SignatureAlgorithm, k interface{}) jose.Signer

MustMakeSigner creates a Signer and panics if an error occurs

Types

type ExtendedClaims

type ExtendedClaims struct {
	Groups          []string          `json:"groups"`
	EMail           string            `json:"email"`
	Name            string            `json:"name"`
	FederatedClaims map[string]string `json:"federated_claims"`
}

Jump to

Keyboard shortcuts

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