File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,37 @@ func TestAuthorizeRequest(t *testing.T) {
175175 toolName : "tool1" ,
176176 expectAllowed : true ,
177177 },
178+ {
179+ name : "no rules falls back to default deny" ,
180+ auth : & filterapi.MCPRouteAuthorization {
181+ DefaultAction : ptr .To (filterapi .AuthorizationActionDeny ),
182+ },
183+ header : "" ,
184+ backendName : "backend1" ,
185+ toolName : "tool1" ,
186+ expectAllowed : false ,
187+ },
188+ {
189+ name : "no bearer token not allowed when rules exist" ,
190+ auth : & filterapi.MCPRouteAuthorization {
191+ DefaultAction : ptr .To (filterapi .AuthorizationActionAllow ),
192+ Rules : []filterapi.MCPRouteAuthorizationRule {
193+ {
194+ Source : filterapi.MCPAuthorizationSource {
195+ JWTSource : filterapi.JWTSource {Scopes : []string {"read" }},
196+ },
197+ Target : filterapi.MCPAuthorizationTarget {
198+ Tools : []filterapi.ToolCall {{BackendName : "backend1" , ToolName : "tool1" }},
199+ },
200+ Action : filterapi .AuthorizationActionDeny ,
201+ },
202+ },
203+ },
204+ header : "" ,
205+ backendName : "backend1" ,
206+ toolName : "tool1" ,
207+ expectAllowed : false ,
208+ },
178209 {
179210 name : "multiple rules, first match applied - denied" ,
180211 auth : & filterapi.MCPRouteAuthorization {
You can’t perform that action at this time.
0 commit comments