mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +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.
19 lines
404 B
Go
19 lines
404 B
Go
package urlutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsHostedAuthenticateDomain(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for _, domain := range HostedAuthenticateDomains {
|
|
assert.True(t, IsHostedAuthenticateDomain(domain), domain)
|
|
}
|
|
|
|
for _, domain := range []string{"authenticate.example.com", "foo.bar"} {
|
|
assert.False(t, IsHostedAuthenticateDomain(domain), domain)
|
|
}
|
|
}
|