mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-10 23:03:23 +02:00
mcp: add to route config, 401 when unauthenticated (#5578)
This commit is contained in:
parent
a10b505386
commit
e71fca76f2
6 changed files with 889 additions and 775 deletions
|
@ -113,6 +113,18 @@ func TestAuthorize_handleResult(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, 495, int(res.GetDeniedResponse().GetStatus().GetCode()))
|
||||
})
|
||||
t.Run("mcp-route-unauthenticated", func(t *testing.T) {
|
||||
res, err := a.handleResult(context.Background(),
|
||||
&envoy_service_auth_v3.CheckRequest{},
|
||||
&evaluator.Request{
|
||||
Policy: &config.Policy{MCP: &config.MCP{}},
|
||||
},
|
||||
&evaluator.Result{
|
||||
Allow: evaluator.NewRuleResult(false, criteria.ReasonUserUnauthenticated),
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 401, int(res.GetDeniedResponse().GetStatus().GetCode()))
|
||||
})
|
||||
}
|
||||
|
||||
func TestAuthorize_okResponse(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue