File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,13 @@ func TestAuthorizeRequest(t *testing.T) {
206206 backendName : "backend1" ,
207207 toolName : "tool1" ,
208208 args : map [string ]any {
209- "payload" : map [string ]any {"kind" : "test" , "value" : 123 },
209+ "payload" : struct {
210+ Kind string `json:"kind"`
211+ Value int `json:"value"`
212+ }{
213+ Kind : "test" ,
214+ Value : 123 ,
215+ },
210216 },
211217 expectAllowed : true ,
212218 },
@@ -377,6 +383,27 @@ func TestAuthorizeRequest(t *testing.T) {
377383 toolName : "tool1" ,
378384 expectAllowed : false ,
379385 },
386+ {
387+ name : "invalid bearer token not allowed when rules exist" ,
388+ auth : & filterapi.MCPRouteAuthorization {
389+ DefaultAction : filterapi .AuthorizationActionAllow ,
390+ Rules : []filterapi.MCPRouteAuthorizationRule {
391+ {
392+ Source : filterapi.MCPAuthorizationSource {
393+ JWTSource : filterapi.JWTSource {Scopes : []string {"read" }},
394+ },
395+ Target : filterapi.MCPAuthorizationTarget {
396+ Tools : []filterapi.ToolCall {{BackendName : "backend1" , ToolName : "tool1" }},
397+ },
398+ Action : filterapi .AuthorizationActionDeny ,
399+ },
400+ },
401+ },
402+ header : "Bearer invalid.token.here" ,
403+ backendName : "backend1" ,
404+ toolName : "tool1" ,
405+ expectAllowed : false ,
406+ },
380407 {
381408 name : "multiple rules, first match applied - denied" ,
382409 auth : & filterapi.MCPRouteAuthorization {
You can’t perform that action at this time.
0 commit comments