Skip to content

Commit b90d888

Browse files
committed
Update the Alibaba/Battle.net/Cognito/Lark/Zoho providers to throw an exception when an invalid/unsupported region is specified
1 parent bcfe2f0 commit b90d888

File tree

4 files changed

+175
-37
lines changed

4 files changed

+175
-37
lines changed

gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ static string GenerateConfigurationClasses(XDocument document)
934934
var template = Template.Parse(@"#nullable enable
935935
#pragma warning disable CS0618
936936
937+
using System.Text.RegularExpressions;
937938
using Microsoft.Extensions.DependencyInjection;
938939
using Microsoft.Extensions.Options;
939940
using Microsoft.IdentityModel.Tokens;

src/OpenIddict.Abstractions/OpenIddictResources.resx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,6 +2208,71 @@ To use the MongoDB integration, reference the 'OpenIddict.MongoDb' package and c
22082208
<data name="ID2183" xml:space="preserve">
22092209
<value>This client application is not allowed to use the pushed authorization request endpoint.</value>
22102210
</data>
2211+
<data name="ID2184" xml:space="preserve">
2212+
<value>The specified Alibaba Cloud/Aliyun region is not valid. Supported values are:
2213+
'China' (or 'CN'),
2214+
'Global' (or 'GLB').</value>
2215+
</data>
2216+
<data name="ID2185" xml:space="preserve">
2217+
<value>The specified Battle.net region is not valid. Supported values are:
2218+
'Asia-Pacific' (or 'APAC'),
2219+
'China' (or 'CN'),
2220+
'European Union' (or 'EU'),
2221+
'United States' (or 'US').</value>
2222+
</data>
2223+
<data name="ID2186" xml:space="preserve">
2224+
<value>The specified Amazon Cognito region is not valid. Supported values are:
2225+
'US East (Ohio)' (or 'us-east-2'),
2226+
'US East (N. Virginia)' (or 'us-east-1'),
2227+
'US West (N. California)' (or 'us-west-1'),
2228+
'US West (Oregon)' (or 'us-west-2'),
2229+
'Africa (Cape Town)' (or 'af-south-1'),
2230+
'Asia Pacific (Hong Kong)' (or 'ap-east-1'),
2231+
'Asia Pacific (Hyderabad)' (or 'ap-south-2'),
2232+
'Asia Pacific (Jakarta)' (or 'ap-southeast-3'),
2233+
'Asia Pacific (Malaysia)' (or 'ap-southeast-5'),
2234+
'Asia Pacific (Melbourne)' (or 'ap-southeast-4'),
2235+
'Asia Pacific (Mumbai)' (or 'ap-south-1'),
2236+
'Asia Pacific (Osaka)' (or 'ap-northeast-3'),
2237+
'Asia Pacific (Seoul)' (or 'ap-northeast-2'),
2238+
'Asia Pacific (Singapore)' (or 'ap-southeast-1'),
2239+
'Asia Pacific (Sydney)' (or 'ap-southeast-2'),
2240+
'Asia Pacific (Tokyo)' (or 'ap-northeast-1'),
2241+
'Canada (Central)' (or 'ca-central-1'),
2242+
'Canada West (Calgary)' (or 'ca-west-1'),
2243+
'Europe (Frankfurt)' (or 'eu-central-1'),
2244+
'Europe (Ireland)' (or 'eu-west-1'),
2245+
'Europe (London)' (or 'eu-west-2'),
2246+
'Europe (Milan)' (or 'eu-south-1'),
2247+
'Europe (Paris)' (or 'eu-west-3'),
2248+
'Europe (Spain)' (or 'eu-south-2'),
2249+
'Europe (Stockholm)' (or 'eu-north-1'),
2250+
'Europe (Zurich)' (or 'eu-central-2'),
2251+
'Israel (Tel Aviv)' (or 'il-central-1'),
2252+
'Middle East (Bahrain)' (or 'me-south-1'),
2253+
'Middle East (UAE)' (or 'me-central-1'),
2254+
'South America (São Paulo)' (or 'sa-east-1'),
2255+
'AWS GovCloud (US-East)' (or 'us-gov-east-1'),
2256+
'AWS GovCloud (US-West)' (or 'us-gov-west-1').
2257+
2258+
Alternatively, any value respecting the '[region]-[subregion]-[identifier]' pattern can also be specified.</value>
2259+
</data>
2260+
<data name="ID2187" xml:space="preserve">
2261+
<value>The specified Lark/Feishu region is not valid. Supported values are:
2262+
'China' (or 'CN'),
2263+
'Global' (or 'GLB').</value>
2264+
</data>
2265+
<data name="ID2188" xml:space="preserve">
2266+
<value>The specified Zoho region is not valid. Supported values are:
2267+
'Australia' (or 'AU'),
2268+
'Canada' (or 'CA'),
2269+
'European Union' (or 'EU'),
2270+
'India' (or 'IN'),
2271+
'Japan' (or 'JP'),
2272+
'Saudi Arabia' (or 'SA'),
2273+
'United Kingdom' (or 'UK'),
2274+
'United States' (or 'US').</value>
2275+
</data>
22112276
<data name="ID4000" xml:space="preserve">
22122277
<value>The '{0}' parameter shouldn't be null or empty at this point.</value>
22132278
</data>

src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ public ValueTask HandleAsync(ProcessAuthenticationContext context)
11471147

11481148
context.UserInfoRequest["fields"] = string.Join(",", settings.Fields);
11491149
}
1150-
1150+
11511151
// Linear's userinfo endpoint is a GraphQL implementation that requires
11521152
// sending a proper "query" parameter containing the requested user details.
11531153
else if (context.Registration.ProviderType is ProviderTypes.Linear)
@@ -1585,7 +1585,7 @@ ProviderTypes.Webflow or ProviderTypes.Weibo or ProviderTypes.Yandex
15851585
// WordPress returns the user identifier as a custom "ID" node:
15861586
ProviderTypes.WordPress => (string?) context.UserInfoResponse?["ID"],
15871587

1588-
// WordPress returns the user identifier as a custom "ZUID" node:
1588+
// Zoho returns the user identifier as a custom "ZUID" node:
15891589
ProviderTypes.Zoho => (string?) context.UserInfoResponse?["ZUID"],
15901590

15911591
_ => context.MergedPrincipal.GetClaim(ClaimTypes.NameIdentifier)
@@ -1937,7 +1937,7 @@ public ValueTask HandleAsync(ProcessChallengeContext context)
19371937
else if (context.Registration.ProviderType is ProviderTypes.Linear)
19381938
{
19391939
var settings = context.Registration.GetLinearSettings();
1940-
1940+
19411941
context.Request.Prompt = settings.Prompt;
19421942
}
19431943

0 commit comments

Comments
 (0)