Documentation
¶
Overview ¶
Package credentialapi owns metadata management and private, workload-bound secret delivery. The resolution endpoint never authenticates human/API keys.
Index ¶
- func Providers(kube client.Client) cb.Registry
- type Handler
- type Limits
- func (l *Limits) AllowColdReview(addr string) bool
- func (l *Limits) AllowRenewal(key string) bool
- func (l *Limits) AllowServer(uid string) bool
- func (l *Limits) CachedAuth(key string) (sessionstate.Server, authState)
- func (l *Limits) ForgetAuth(key string)
- func (l *Limits) RecentFailure(key string) bool
- func (l *Limits) RecordAuth(key string, server sessionstate.Server, valid bool)
- func (l *Limits) RecordFailure(key string)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Providers ¶
Providers are process-owned; source metadata cannot choose endpoints or supply provider credentials. Reads use ambient workload identity. No provider error text or response body escapes this package. Providers returns the reader Registry the broker resolves through. Only the kubernetes provider is enabled (cb.ProviderSupported); cloud readers live in cloud_readers.go and are intentionally not registered.
Readers are process-owned; source metadata cannot choose endpoints or supply provider credentials. No provider error text escapes this package.
Types ¶
type Handler ¶
type Handler struct {
Store Store
Kube client.Client
Authenticate func(context.Context, string) (sessionstate.Server, error)
Providers cb.Registry
// Limits bounds resolution requests per source address (before TokenReview)
// and per server, and briefly remembers provider failures. Nil uses a
// process-wide default.
Limits *Limits
}
func (Handler) Management ¶
func (h Handler) Management(w http.ResponseWriter, r *http.Request)
type Limits ¶
Limits holds rate limiters and a short, bounded negative cache of provider failures. It never stores secret values: only a key and an expiry.
func (*Limits) AllowColdReview ¶
AllowColdReview charges the global TokenReview budget and the per-source budget. It applies only to tokens not already verified or rejected recently, so traffic with unknown tokens can never throttle a cached valid caller.
func (*Limits) AllowRenewal ¶
AllowRenewal charges only the token's own renewal budget, never the cold-token or per-source budgets.
func (*Limits) AllowServer ¶
func (*Limits) CachedAuth ¶
func (l *Limits) CachedAuth(key string) (sessionstate.Server, authState)
CachedAuth returns the cached verdict state for a token hash.
func (*Limits) ForgetAuth ¶
ForgetAuth drops a token's valid verdict after a definite rejection.
func (*Limits) RecentFailure ¶
RecentFailure reports whether a provider read for key failed within failureTTL.
func (*Limits) RecordAuth ¶
func (l *Limits) RecordAuth(key string, server sessionstate.Server, valid bool)
func (*Limits) RecordFailure ¶
type Store ¶
type Store interface {
ListCredentials(context.Context, passport.Principal, string, string) ([]json.RawMessage, error)
PutCredential(context.Context, passport.Principal, *cb.Source, *cb.Binding) (json.RawMessage, error)
DeleteCredential(context.Context, passport.Principal, string, string, string, int64) error
// UseCredentials calls authorize before and again after fetch. fetch (provider
// I/O) must run without holding shared locks; the value is returned only if
// the second authorize, run after re-reading current state, still allows it.
UseCredentials(ctx context.Context, server sessionstate.Server, request cb.ResolutionRequest, authorize func(sessionstate.Session, []cb.Binding, []cb.Source) error, fetch func(sessionstate.Session, []cb.Binding, []cb.Source) (cb.Delivery, error)) (cb.Delivery, error)
}