jwt

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 4 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 interface{}, privateClaims ...interface{}) (string, error)

CreateToken creates a jwt token with the given claims

func GenerateToken

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

Types

type DexTokenGenerator added in v0.7.0

type DexTokenGenerator struct {
	FederatedClaims map[string]string
}

DexTokenGenerator provides MustCreateTokenAndKeys as the dex-variant-impl of the security.TokenProvider to create tokens for testing.

func (*DexTokenGenerator) CreateTokenAndKeys added in v0.7.0

func (d *DexTokenGenerator) CreateTokenAndKeys(cfg *security.TokenCfg) (token string, pubKey jose.JSONWebKey, privKey jose.JSONWebKey, err error)

CreateTokenAndKeys creates a keyset and token

func (*DexTokenGenerator) MustCreateTokenAndKeys added in v0.7.0

func (d *DexTokenGenerator) MustCreateTokenAndKeys(cfg *security.TokenCfg) (token string, pubKey jose.JSONWebKey, privKey jose.JSONWebKey)

MustCreateTokenAndKeys creates a keyset and token, panics on error

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