mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
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.
25 lines
766 B
Go
25 lines
766 B
Go
package urlutil
|
|
|
|
// HostedAuthenticateDomains is a list of all known domains associated with the
|
|
// hosted authenticate service.
|
|
var HostedAuthenticateDomains = []string{
|
|
"authenticate.pomerium.app",
|
|
"authenticate.staging.pomerium.app",
|
|
}
|
|
|
|
var hostedAuthenticateDomainSet = initHostedAuthenticateDomainSet()
|
|
|
|
func initHostedAuthenticateDomainSet() map[string]struct{} {
|
|
s := make(map[string]struct{})
|
|
for _, domain := range HostedAuthenticateDomains {
|
|
s[domain] = struct{}{}
|
|
}
|
|
return s
|
|
}
|
|
|
|
// IsHostedAuthenticateDomain indicates whether the given domain is associated
|
|
// with the hosted authenticate service.
|
|
func IsHostedAuthenticateDomain(domain string) bool {
|
|
_, isHostedAuthenticate := hostedAuthenticateDomainSet[domain]
|
|
return isHostedAuthenticate
|
|
}
|