@@ -805,21 +805,21 @@ public sealed partial class {{ provider.name }}
805805 return template . Render ( new
806806 {
807807 Providers = document . Root . Elements ( "Provider" )
808- . Select ( provider => new
808+ . Select ( static provider => new
809809 {
810810 Name = ( string ) provider . Attribute ( "Name" ) ,
811811 DisplayName = ( string ? ) provider . Attribute ( "DisplayName" ) ?? ( string ) provider . Attribute ( "Name" ) ,
812812 Documentation = ( string ? ) provider . Attribute ( "Documentation" ) ,
813813
814814 Obsolete = ( bool ? ) provider . Attribute ( "Obsolete" ) ?? false ,
815815
816- Environments = provider . Elements ( "Environment" ) . Select ( environment => new
816+ Environments = provider . Elements ( "Environment" ) . Select ( static environment => new
817817 {
818818 Name = ( string ? ) environment . Attribute ( "Name" ) ?? "Production"
819819 } )
820820 . ToList ( ) ,
821821
822- Settings = provider . Elements ( "Setting" ) . Select ( setting => new
822+ Settings = provider . Elements ( "Setting" ) . Select ( static setting => new
823823 {
824824 PropertyName = ( string ) setting . Attribute ( "PropertyName" ) ,
825825 ParameterName = ( string ) setting . Attribute ( "ParameterName" ) ,
@@ -886,6 +886,15 @@ public static class Properties
886886 public const string {{ property.name }} = ""{{ property.dictionary_key }}"";
887887 {{~ end ~}}
888888 }
889+
890+ {{~ for group in provider.constants ~}}
891+ public static class {{ group.key }}
892+ {
893+ {{~ for constant in group ~}}
894+ public const string {{ constant.name }} = ""{{ constant.value }}"";
895+ {{~ end ~}}
896+ }
897+ {{~ end ~}}
889898 }
890899 {{~ end ~}}
891900
@@ -907,23 +916,33 @@ public static class ProviderTypes
907916 return template . Render ( new
908917 {
909918 Providers = document . Root . Elements ( "Provider" )
910- . Select ( provider => new
919+ . Select ( static provider => new
911920 {
912921 Name = ( string ) provider . Attribute ( "Name" ) ,
913922 Id = ( string ) provider . Attribute ( "Id" ) ,
914923
915- Environments = provider . Elements ( "Environment" ) . Select ( environment => new
924+ Environments = provider . Elements ( "Environment" ) . Select ( static environment => new
916925 {
917926 Name = ( string ? ) environment . Attribute ( "Name" ) ?? "Production"
918927 } )
919928 . ToList ( ) ,
920929
921- Properties = provider . Elements ( "Property" ) . Select ( property => new
930+ Properties = provider . Elements ( "Property" ) . Select ( static property => new
922931 {
923932 Name = ( string ) property . Attribute ( "Name" ) ,
924933 DictionaryKey = ( string ) property . Attribute ( "DictionaryKey" )
925934 } )
926935 . ToList ( ) ,
936+
937+ Constants = provider . Elements ( "Constant" )
938+ . Select ( static constant => new
939+ {
940+ Class = ( string ) constant . Attribute ( "Class" ) ,
941+ Name = ( string ) constant . Attribute ( "Name" ) ,
942+ Value = ( string ) constant . Attribute ( "Value" )
943+ } )
944+ . GroupBy ( static constant => constant . Class )
945+ . ToList ( ) ,
927946 } )
928947 . ToList ( )
929948 } ) ;
@@ -1289,12 +1308,12 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
12891308 return template . Render ( new
12901309 {
12911310 Providers = document . Root . Elements ( "Provider" )
1292- . Select ( provider => new
1311+ . Select ( static provider => new
12931312 {
12941313 Name = ( string ) provider . Attribute ( "Name" ) ,
12951314 DisplayName = ( string ? ) provider . Attribute ( "DisplayName" ) ?? ( string ) provider . Attribute ( "Name" ) ,
12961315
1297- Environments = provider . Elements ( "Environment" ) . Select ( environment => new
1316+ Environments = provider . Elements ( "Environment" ) . Select ( static environment => new
12981317 {
12991318 Name = ( string ? ) environment . Attribute ( "Name" ) ?? "Production" ,
13001319
@@ -1314,45 +1333,45 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13141333
13151334 CodeChallengeMethodsSupported = configuration . Elements ( "CodeChallengeMethod" ) . ToList ( ) switch
13161335 {
1317- { Count : > 0 } methods => methods . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1336+ { Count : > 0 } methods => methods . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13181337
13191338 _ => [ ]
13201339 } ,
13211340
13221341 GrantTypesSupported = configuration . Elements ( "GrantType" ) . ToList ( ) switch
13231342 {
1324- { Count : > 0 } types => types . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1343+ { Count : > 0 } types => types . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13251344
13261345 // If no explicit grant type was set, assume the provider only supports the code flow.
13271346 _ => [ GrantTypes . AuthorizationCode ]
13281347 } ,
13291348
13301349 ResponseModesSupported = configuration . Elements ( "ResponseMode" ) . ToList ( ) switch
13311350 {
1332- { Count : > 0 } modes => modes . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1351+ { Count : > 0 } modes => modes . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13331352
13341353 // If no explicit response mode was set, assume the provider only supports the query response mode.
13351354 _ => [ ResponseModes . Query ]
13361355 } ,
13371356
13381357 ResponseTypesSupported = configuration . Elements ( "ResponseType" ) . ToList ( ) switch
13391358 {
1340- { Count : > 0 } types => types . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1359+ { Count : > 0 } types => types . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13411360
13421361 // If no explicit response type was set, assume the provider only supports the code flow.
13431362 _ => [ ResponseTypes . Code ]
13441363 } ,
13451364
13461365 ScopesSupported = configuration . Elements ( "Scope" ) . ToList ( ) switch
13471366 {
1348- { Count : > 0 } types => types . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1367+ { Count : > 0 } types => types . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13491368
13501369 _ => [ ]
13511370 } ,
13521371
13531372 DeviceAuthorizationEndpointAuthMethodsSupported = configuration . Elements ( "DeviceAuthorizationEndpointAuthMethod" ) . ToList ( ) switch
13541373 {
1355- { Count : > 0 } methods => methods . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1374+ { Count : > 0 } methods => methods . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13561375
13571376 // If no explicit client authentication method was set, assume the provider only supports
13581377 // flowing the client credentials as part of the device authorization request payload.
@@ -1361,7 +1380,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13611380
13621381 IntrospectionEndpointAuthMethodsSupported = configuration . Elements ( "IntrospectionEndpointAuthMethod" ) . ToList ( ) switch
13631382 {
1364- { Count : > 0 } methods => methods . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1383+ { Count : > 0 } methods => methods . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13651384
13661385 // If no explicit client authentication method was set, assume the provider only
13671386 // supports flowing the client credentials as part of the introspection request payload.
@@ -1370,7 +1389,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13701389
13711390 RevocationEndpointAuthMethodsSupported = configuration . Elements ( "RevocationEndpointAuthMethod" ) . ToList ( ) switch
13721391 {
1373- { Count : > 0 } methods => methods . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1392+ { Count : > 0 } methods => methods . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13741393
13751394 // If no explicit client authentication method was set, assume the provider only
13761395 // supports flowing the client credentials as part of the revocation request payload.
@@ -1379,7 +1398,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13791398
13801399 TokenEndpointAuthMethodsSupported = configuration . Elements ( "TokenEndpointAuthMethod" ) . ToList ( ) switch
13811400 {
1382- { Count : > 0 } methods => methods . Select ( type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
1401+ { Count : > 0 } methods => methods . Select ( static type => ( string ? ) type . Attribute ( "Value" ) ) . ToList ( ) ,
13831402
13841403 // If no explicit client authentication method was set, assume the provider only
13851404 // supports flowing the client credentials as part of the token request payload.
@@ -1390,7 +1409,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13901409 _ => null
13911410 } ,
13921411
1393- Scopes = environment . Elements ( "Scope" ) . Select ( setting => new
1412+ Scopes = environment . Elements ( "Scope" ) . Select ( static setting => new
13941413 {
13951414 Name = ( string ) setting . Attribute ( "Name" ) ,
13961415 Default = ( bool ? ) setting . Attribute ( "Default" ) ?? false ,
@@ -1399,7 +1418,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
13991418 } )
14001419 . ToList ( ) ,
14011420
1402- Settings = provider . Elements ( "Setting" ) . Select ( setting => new
1421+ Settings = provider . Elements ( "Setting" ) . Select ( static setting => new
14031422 {
14041423 PropertyName = ( string ) setting . Attribute ( "PropertyName" ) ,
14051424
@@ -1412,7 +1431,7 @@ public static partial void ConfigureProvider(OpenIddictClientRegistration regist
14121431
14131432 DefaultValue = ( string ? ) setting . Attribute ( "DefaultValue" ) ,
14141433
1415- Items = setting . Elements ( "Item" ) . Select ( item => new
1434+ Items = setting . Elements ( "Item" ) . Select ( static item => new
14161435 {
14171436 Value = ( string ) item . Attribute ( "Value" ) ,
14181437 Default = ( bool ? ) item . Attribute ( "Default" ) ?? false ,
@@ -1456,7 +1475,7 @@ public static partial class OpenIddictClientWebIntegrationHelpers
14561475 return template . Render ( new
14571476 {
14581477 Providers = document . Root . Elements ( "Provider" )
1459- . Select ( provider => new
1478+ . Select ( static provider => new
14601479 {
14611480 Name = ( string ) provider . Attribute ( "Name" ) ,
14621481 DisplayName = ( string ? ) provider . Attribute ( "DisplayName" ) ?? ( string ) provider . Attribute ( "Name" )
@@ -1508,12 +1527,12 @@ public sealed class {{ provider.name }}
15081527 return template . Render ( new
15091528 {
15101529 Providers = document . Root . Elements ( "Provider" )
1511- . Select ( provider => new
1530+ . Select ( static provider => new
15121531 {
15131532 Name = ( string ) provider . Attribute ( "Name" ) ,
15141533 DisplayName = ( string ? ) provider . Attribute ( "DisplayName" ) ?? ( string ) provider . Attribute ( "Name" ) ,
15151534
1516- Settings = provider . Elements ( "Setting" ) . Select ( setting => new
1535+ Settings = provider . Elements ( "Setting" ) . Select ( static setting => new
15171536 {
15181537 PropertyName = ( string ) setting . Attribute ( "PropertyName" ) ,
15191538
@@ -1555,8 +1574,4 @@ public sealed class {{ provider.name }}
15551574 } ) ;
15561575 }
15571576 }
1558-
1559- public void Initialize ( GeneratorInitializationContext context )
1560- {
1561- }
15621577}
0 commit comments