jwe

package
v0.0.0-...-ecf1725 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportRSAKeyOrDie

func ExportRSAKeyOrDie(privKey *rsa.PrivateKey) (priv, pub string)

ExportRSAKeyOrDie exports rsa key object to a private/public strings. In case of fail panic is called.

func NewJWETokenManager

func NewJWETokenManager(holder KeyHolder) authApi.TokenManager

Creates and returns default JWE token manager instance.

func ParseRSAKey

func ParseRSAKey(privStr, pubStr string) (*rsa.PrivateKey, error)

ParseRSAKey parses private/public key strings and returns rsa key object or error.

Types

type AdditionalAuthData

type AdditionalAuthData map[Claim]string

AdditionalAuthData contains information required to validate token. It is integrity protected. For more information check: https://tools.ietf.org/html/rfc7516 (Chapter 2: Terminology)

type Claim

type Claim string

Claim represent token claims used in AAD header. For more information check: https://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#rfc.section.4

const (

	// IAT claim is part of token AAD header. It represents token "issued at" time.
	IAT Claim = "iat"
	// EXP claim is part of token AAD header. It represents token expiration time.
	EXP Claim = "exp"
)

type KeyHolder

type KeyHolder interface {
	// Returns encrypter instance that can be used to encrypt data.
	Encrypter() jose.Encrypter
	// Returns encryption key that can be used to decrypt data.
	Key() *rsa.PrivateKey
	// Forces refresh of encryption key synchronized with kubernetes resource (secret).
	Refresh()
}

KeyHolder is responsible for generating, storing and synchronizing encryption key used for token generation/decryption.

func NewRSAKeyHolder

func NewRSAKeyHolder(synchronizer syncApi.Synchronizer) KeyHolder

NewRSAKeyHolder creates new KeyHolder instance.

Jump to

Keyboard shortcuts

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