mocks

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAudCommit

func AddAudCommit(idtTemp *IDTokenTemplate, cicHash string)

func AddNonceCommit

func AddNonceCommit(idtTemp *IDTokenTemplate, cicHash string)

func CreateES256KeySet

func CreateES256KeySet(issuer string, numKeys int) (map[string]crypto.Signer, map[string]discover.PublicKeyRecord, error)

func CreateKeySet

func CreateKeySet(issuer string, alg string, numKeys int) (map[string]crypto.Signer, map[string]discover.PublicKeyRecord, error)

func CreateRS256KeySet

func CreateRS256KeySet(issuer string, numKeys int) (map[string]crypto.Signer, map[string]discover.PublicKeyRecord, error)

func NoClaimCommit

func NoClaimCommit(idtTemp *IDTokenTemplate, cicHash string)

Types

type CommitmentType

type CommitmentType struct {
	ClaimCommitment bool
	ClaimName       string
}

type IDTokenTemplate

type IDTokenTemplate struct {
	CommitFunc           func(*IDTokenTemplate, string)
	Issuer               string
	Nonce                string
	NoNonce              bool
	Aud                  string
	KeyID                string
	NoKeyID              bool
	Alg                  string
	NoAlg                bool // Even if NOAlg is true, we still need Alg to be set to generate the signature
	ExtraClaims          map[string]any
	ExtraProtectedClaims map[string]any
	SigningKey           crypto.Signer // The key we will use to sign the ID Token
}

func DefaultIDTokenTemplate

func DefaultIDTokenTemplate() IDTokenTemplate

func (*IDTokenTemplate) AddCommit

func (t *IDTokenTemplate) AddCommit(cicHash string)

AddCommit adds the commitment to the CIC to the ID Token. The CommitmentFunc is specified allowing custom commitment functions to be specified

func (*IDTokenTemplate) IssueToken

func (t *IDTokenTemplate) IssueToken() ([]byte, error)

type MockProviderBackend

type MockProviderBackend struct {
	Issuer                string
	PublicKeyFinder       discover.PublicKeyFinder
	ProviderSigningKeySet map[string]crypto.Signer            // kid (keyId) -> signing key
	ProviderPublicKeySet  map[string]discover.PublicKeyRecord // kid (keyId) -> PublicKeyRecord
	IDTokensTemplate      *IDTokenTemplate
}

func NewMockProviderBackend

func NewMockProviderBackend(issuer string, numKeys int) (*MockProviderBackend, error)

func (*MockProviderBackend) GetProviderPublicKeySet

func (o *MockProviderBackend) GetProviderPublicKeySet() map[string]discover.PublicKeyRecord

func (*MockProviderBackend) GetProviderSigningKeySet

func (o *MockProviderBackend) GetProviderSigningKeySet() map[string]crypto.Signer

func (*MockProviderBackend) GetPublicKeyFinder

func (o *MockProviderBackend) GetPublicKeyFinder() *discover.PublicKeyFinder

func (*MockProviderBackend) RandomSigningKey

func (o *MockProviderBackend) RandomSigningKey() (crypto.Signer, string, discover.PublicKeyRecord)

func (*MockProviderBackend) RequestTokenOverrideFunc

func (o *MockProviderBackend) RequestTokenOverrideFunc(cicHash string) ([]byte, error)

func (*MockProviderBackend) SetIDTokenTemplate

func (o *MockProviderBackend) SetIDTokenTemplate(template *IDTokenTemplate)

Jump to

Keyboard shortcuts

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