mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-02 19:04:14 +02:00
authorize: fix google cloudrun header audience (#2558)
This commit is contained in:
parent
511ab66523
commit
de1ed61b9a
2 changed files with 18 additions and 1 deletions
|
@ -31,7 +31,7 @@ func NewHeadersRequestFromPolicy(policy *config.Policy) *HeadersRequest {
|
||||||
}
|
}
|
||||||
input.KubernetesServiceAccountToken = policy.KubernetesServiceAccountToken
|
input.KubernetesServiceAccountToken = policy.KubernetesServiceAccountToken
|
||||||
for _, wu := range policy.To {
|
for _, wu := range policy.To {
|
||||||
input.ToAudience = wu.URL.Hostname()
|
input.ToAudience = "https://" + wu.URL.Hostname()
|
||||||
}
|
}
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,23 @@ import (
|
||||||
"github.com/pomerium/pomerium/pkg/grpc/user"
|
"github.com/pomerium/pomerium/pkg/grpc/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestNewHeadersRequestFromPolicy(t *testing.T) {
|
||||||
|
req := NewHeadersRequestFromPolicy(&config.Policy{
|
||||||
|
EnableGoogleCloudServerlessAuthentication: true,
|
||||||
|
From: "https://from.example.com",
|
||||||
|
To: config.WeightedURLs{
|
||||||
|
{
|
||||||
|
URL: *mustParseURL("http://to.example.com"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
assert.Equal(t, &HeadersRequest{
|
||||||
|
EnableGoogleCloudServerlessAuthentication: true,
|
||||||
|
FromAudience: "from.example.com",
|
||||||
|
ToAudience: "https://to.example.com",
|
||||||
|
}, req)
|
||||||
|
}
|
||||||
|
|
||||||
func TestHeadersEvaluator(t *testing.T) {
|
func TestHeadersEvaluator(t *testing.T) {
|
||||||
type A = []interface{}
|
type A = []interface{}
|
||||||
type M = map[string]interface{}
|
type M = map[string]interface{}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue