@@ -849,7 +849,7 @@ describe("OAuth Authorization", () => {
849849 } ) ;
850850
851851 expect ( result ) . toBe ( "REDIRECT" ) ;
852-
852+
853853 // Verify the authorization URL includes the resource parameter
854854 expect ( mockProvider . redirectToAuthorization ) . toHaveBeenCalledWith (
855855 expect . objectContaining ( {
@@ -866,7 +866,7 @@ describe("OAuth Authorization", () => {
866866 // Mock successful metadata discovery and token exchange
867867 mockFetch . mockImplementation ( ( url ) => {
868868 const urlString = url . toString ( ) ;
869-
869+
870870 if ( urlString . includes ( "/.well-known/oauth-authorization-server" ) ) {
871871 return Promise . resolve ( {
872872 ok : true ,
@@ -891,7 +891,7 @@ describe("OAuth Authorization", () => {
891891 } ) ,
892892 } ) ;
893893 }
894-
894+
895895 return Promise . resolve ( { ok : false , status : 404 } ) ;
896896 } ) ;
897897
@@ -912,11 +912,11 @@ describe("OAuth Authorization", () => {
912912 expect ( result ) . toBe ( "AUTHORIZED" ) ;
913913
914914 // Find the token exchange call
915- const tokenCall = mockFetch . mock . calls . find ( call =>
915+ const tokenCall = mockFetch . mock . calls . find ( call =>
916916 call [ 0 ] . toString ( ) . includes ( "/token" )
917917 ) ;
918918 expect ( tokenCall ) . toBeDefined ( ) ;
919-
919+
920920 const body = tokenCall ! [ 1 ] . body as URLSearchParams ;
921921 expect ( body . get ( "resource" ) ) . toBe ( "https://api.example.com/mcp-server" ) ;
922922 expect ( body . get ( "code" ) ) . toBe ( "auth-code-123" ) ;
@@ -926,7 +926,7 @@ describe("OAuth Authorization", () => {
926926 // Mock successful metadata discovery and token refresh
927927 mockFetch . mockImplementation ( ( url ) => {
928928 const urlString = url . toString ( ) ;
929-
929+
930930 if ( urlString . includes ( "/.well-known/oauth-authorization-server" ) ) {
931931 return Promise . resolve ( {
932932 ok : true ,
@@ -950,7 +950,7 @@ describe("OAuth Authorization", () => {
950950 } ) ,
951951 } ) ;
952952 }
953-
953+
954954 return Promise . resolve ( { ok : false , status : 404 } ) ;
955955 } ) ;
956956
@@ -973,29 +973,29 @@ describe("OAuth Authorization", () => {
973973 expect ( result ) . toBe ( "AUTHORIZED" ) ;
974974
975975 // Find the token refresh call
976- const tokenCall = mockFetch . mock . calls . find ( call =>
976+ const tokenCall = mockFetch . mock . calls . find ( call =>
977977 call [ 0 ] . toString ( ) . includes ( "/token" )
978978 ) ;
979979 expect ( tokenCall ) . toBeDefined ( ) ;
980-
980+
981981 const body = tokenCall ! [ 1 ] . body as URLSearchParams ;
982982 expect ( body . get ( "resource" ) ) . toBe ( "https://api.example.com/mcp-server" ) ;
983983 expect ( body . get ( "grant_type" ) ) . toBe ( "refresh_token" ) ;
984984 expect ( body . get ( "refresh_token" ) ) . toBe ( "refresh123" ) ;
985985 } ) ;
986986
987- it ( "skips default PRM resource validation when custom validateProtectedResourceMetadata is provided" , async ( ) => {
988- const mockValidateProtectedResourceMetadata = jest . fn ( ) . mockResolvedValue ( undefined ) ;
987+ it ( "skips default PRM resource validation when custom validateResourceURL is provided" , async ( ) => {
988+ const mockValidateResourceURL = jest . fn ( ) . mockResolvedValue ( undefined ) ;
989989 const providerWithCustomValidation = {
990990 ...mockProvider ,
991- validateProtectedResourceMetadata : mockValidateProtectedResourceMetadata ,
991+ validateResourceURL : mockValidateResourceURL ,
992992 } ;
993993
994994 // Mock protected resource metadata with mismatched resource URL
995995 // This would normally throw an error in default validation, but should be skipped
996996 mockFetch . mockImplementation ( ( url ) => {
997997 const urlString = url . toString ( ) ;
998-
998+
999999 if ( urlString . includes ( "/.well-known/oauth-protected-resource" ) ) {
10001000 return Promise . resolve ( {
10011001 ok : true ,
@@ -1018,7 +1018,7 @@ describe("OAuth Authorization", () => {
10181018 } ) ,
10191019 } ) ;
10201020 }
1021-
1021+
10221022 return Promise . resolve ( { ok : false , status : 404 } ) ;
10231023 } ) ;
10241024
@@ -1037,12 +1037,12 @@ describe("OAuth Authorization", () => {
10371037 } ) ;
10381038
10391039 expect ( result ) . toBe ( "REDIRECT" ) ;
1040-
1040+
10411041 // Verify custom validation method was called
1042- expect ( mockValidateProtectedResourceMetadata ) . toHaveBeenCalledWith ( {
1043- resource : "https://different-resource .example.com/mcp-server" ,
1044- authorization_servers : [ "https://auth .example.com" ] ,
1045- } ) ;
1042+ expect ( mockValidateResourceURL ) . toHaveBeenCalledWith (
1043+ "https://api .example.com/mcp-server" ,
1044+ "https://different-resource .example.com/mcp-server"
1045+ ) ;
10461046 } ) ;
10471047 } ) ;
10481048} ) ;
0 commit comments