credentials

package
v0.40.7 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 32 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultSigner

type DefaultSigner struct {
	// contains filtered or unexported fields
}

func NewSignerDefault

func NewSignerDefault(r FetcherRegistry) *DefaultSigner

func (*DefaultSigner) Sign

func (s *DefaultSigner) Sign(ctx context.Context, location *url.URL, claims jwt.Claims) (string, error)

type Fetcher

type Fetcher interface {
	ResolveKey(ctx context.Context, locations []url.URL, kid string, use string) (*jose.JSONWebKey, error)
	ResolveSets(ctx context.Context, locations []url.URL) ([]jose.JSONWebKeySet, error)
}

type FetcherDefault

type FetcherDefault struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFetcherDefault

func NewFetcherDefault(d dependencies, cancelAfter time.Duration, ttl time.Duration, opts ...FetcherOption) *FetcherDefault

NewFetcherDefault returns a new JWKS Fetcher with:

  • cancelAfter: If reached, the fetcher will stop waiting for responses and return an error.
  • waitForResponse: While the fetcher might stop waiting for responses, we will give the server more time to respond and add the keys to the registry unless waitForResponse is reached in which case we'll terminate the request.

func (*FetcherDefault) ResolveKey

func (s *FetcherDefault) ResolveKey(ctx context.Context, locations []url.URL, kid string, use string) (*jose.JSONWebKey, error)

func (*FetcherDefault) ResolveSets

func (s *FetcherDefault) ResolveSets(ctx context.Context, locations []url.URL) ([]jose.JSONWebKeySet, error)

type FetcherOption added in v0.40.1

type FetcherOption func(f *FetcherDefault)

func WithURLMux added in v0.40.1

func WithURLMux(mux *blob.URLMux) FetcherOption

type FetcherRegistry

type FetcherRegistry interface {
	CredentialsFetcher() Fetcher
}

type Signer

type Signer interface {
	Sign(ctx context.Context, location *url.URL, claims jwt.Claims) (string, error)
}

type SignerRegistry

type SignerRegistry interface {
	CredentialsSigner() Signer
}

type ValidationContext

type ValidationContext struct {
	Algorithms    []string
	Issuers       []string
	Audiences     []string
	ScopeStrategy fosite.ScopeStrategy
	Scope         []string
	KeyURLs       []url.URL
}

type Verifier

type Verifier interface {
	Verify(
		ctx context.Context,
		token string,
		r *ValidationContext,
	) (*jwt.Token, error)
}

type VerifierDefault

type VerifierDefault struct {
	// contains filtered or unexported fields
}

func NewVerifierDefault

func NewVerifierDefault(f FetcherRegistry) *VerifierDefault

func (*VerifierDefault) Verify

func (v *VerifierDefault) Verify(
	ctx context.Context,
	token string,
	r *ValidationContext,
) (*jwt.Token, error)

type VerifierRegistry

type VerifierRegistry interface {
	CredentialsVerifier() Verifier
}

Jump to

Keyboard shortcuts

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