@@ -8,14 +8,24 @@ namespace ModelContextProtocol.Authentication;
88/// </summary>
99public class ProtectedResourceMetadata
1010{
11+ /// <summary>
12+ /// Initializes a new instance of the <see cref="ProtectedResourceMetadata"/> class.
13+ /// </summary>
14+ public ProtectedResourceMetadata ( )
15+ {
16+ AuthorizationServers = [ ] ;
17+ BearerMethodsSupported = [ ] ;
18+ ScopesSupported = [ ] ;
19+ }
20+
1121 /// <summary>
1222 /// The resource URI.
1323 /// </summary>
1424 /// <remarks>
1525 /// REQUIRED. The protected resource's resource identifier.
1626 /// </remarks>
1727 [ JsonPropertyName ( "resource" ) ]
18- public Uri Resource { get ; set ; } = null ! ;
28+ public required Uri Resource { get ; init ; }
1929
2030 /// <summary>
2131 /// The list of authorization server URIs.
@@ -25,7 +35,7 @@ public class ProtectedResourceMetadata
2535 /// for authorization servers that can be used with this protected resource.
2636 /// </remarks>
2737 [ JsonPropertyName ( "authorization_servers" ) ]
28- public List < Uri > AuthorizationServers { get ; set ; } = new ( ) ;
38+ public List < Uri > AuthorizationServers { get ; set ; }
2939
3040 /// <summary>
3141 /// The supported bearer token methods.
@@ -35,7 +45,7 @@ public class ProtectedResourceMetadata
3545 /// to the protected resource. Defined values are ["header", "body", "query"].
3646 /// </remarks>
3747 [ JsonPropertyName ( "bearer_methods_supported" ) ]
38- public List < string > BearerMethodsSupported { get ; set ; } = new ( ) ;
48+ public List < string > BearerMethodsSupported { get ; set ; }
3949
4050 /// <summary>
4151 /// The supported scopes.
@@ -45,7 +55,7 @@ public class ProtectedResourceMetadata
4555 /// requests to request access to this protected resource.
4656 /// </remarks>
4757 [ JsonPropertyName ( "scopes_supported" ) ]
48- public List < string > ScopesSupported { get ; set ; } = new ( ) ;
58+ public List < string > ScopesSupported { get ; set ; }
4959
5060 /// <summary>
5161 /// URL of the protected resource's JSON Web Key (JWK) Set document.
0 commit comments