pomerium/pkg/hpke/stub.go
Kenneth Jenkins a1388592d8
stub out HPKE public key fetch for self-hosted authenticate (#4360)
Fetch the HPKE public key only when configured to use the hosted
authenticate service. Determine whether we are using the hosted
authenticate service by comparing the resolved authenticate domain with
a hard-coded list of hosted authenticate domains.

Extract this list of hosted authenticate domains to the internal/urlutil
package in order to keep a single source of truth for this data.
2023-07-13 10:04:34 -07:00

18 lines
333 B
Go

package hpke
import (
"context"
)
type stubFetcher struct {
key *PublicKey
}
func (f stubFetcher) FetchPublicKey(_ context.Context) (*PublicKey, error) {
return f.key, nil
}
// NewStubKeyFetcher returns a new KeyFetcher which returns a fixed key.
func NewStubKeyFetcher(key *PublicKey) KeyFetcher {
return stubFetcher{key}
}