Version: v0.0.0-...-9ddf544 Latest Latest

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 9 Imported by: 0




View Source
const (
	// DefaultOpaqueTokenLen defines default token code length.
	DefaultOpaqueTokenLen = 28


View Source
var ErrInvalidTokenSignature = errors.New("invalid token signature")

ErrInvalidTokenSignature is raised when token is signed with a private key where the public key is not known by the keyset.


func IsUsable

func IsUsable(t *corev1.Token) bool

IsUsable check token usability constraint.


type Generator

type Generator interface {
	Generate(ctx context.Context, t *corev1.Token) (string, error)

Generator describes claims generator contract.

func AccessToken

func AccessToken(signer Signer) Generator

AccessToken instantiate an access token generator.

func ClientAssertion

func ClientAssertion(signer Signer) Generator

ClientAssertion instantiate a client assertion generator.

func Introspection

func Introspection(signer Signer) Generator

Introspection instantiate an introspection assertion generator.

func OpaqueToken

func OpaqueToken() Generator

OpaqueToken returns the default token generator.

func RefreshToken

func RefreshToken(signer Signer) Generator

RefreshToken instantiate an refresh token generator.

type Signer

type Signer interface {
	Sign(ctx context.Context, claims interface{}) (string, error)

Signer describe Token signer contract.

type Token

type Token interface {
	Algorithm() (string, error)
	Type() (string, error)
	KeyID() (string, error)
	PublicKey() (interface{}, error)
	PublicKeyThumbPrint() (string, error)
	Claims(publicKey interface{}, claims interface{}) error

Token represents a jwt token contract.

type Verifier

type Verifier interface {
	Parse(token string) (Token, error)
	Verify(token string) error
	Claims(ctx context.Context, token string, claims interface{}) error

Verifier describes Token verifier contract.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL