Skip to content

Commit 996ffee

Browse files
committed
Remove the runtime checks that prevent the generic version of OpenIddict.Client.SystemIntegration from being used on Android/iOS/macOS/Mac Catalyst
1 parent 0048dc4 commit 996ffee

File tree

4 files changed

+11
-49
lines changed

4 files changed

+11
-49
lines changed

src/OpenIddict.Abstractions/OpenIddictResources.resx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ To apply post-logout redirection responses, create a class implementing 'IOpenId
15601560
<value>An explicit grant type must be attached when specifying a specific response type (except when using the special response_type=none value).</value>
15611561
</data>
15621562
<data name="ID0446" xml:space="preserve">
1563-
<value>AS web authentication sessions are only supported on iOS 12.0 and higher.</value>
1563+
<value>AS web authentication sessions are only supported on iOS 12.0+/macOS 10.15+/Mac Catalyst 12.0+ and require using an OS-specific target framework moniker (e.g on macOS, 'net8.0-macos15.0').</value>
15641564
</data>
15651565
<data name="ID0447" xml:space="preserve">
15661566
<value>The current UI window cannot be resolved.</value>
@@ -1570,6 +1570,7 @@ To apply post-logout redirection responses, create a class implementing 'IOpenId
15701570
</data>
15711571
<data name="ID0449" xml:space="preserve">
15721572
<value>The generic version of the OpenIddict.Client.SystemIntegration package cannot be used on this platform. Make sure your application is referencing the correct version by using the appropriate OS-specific TFM (e.g on macOS, 'net8.0-macos10.15').</value>
1573+
<comment>This resource is no longer used and will be removed in a future version.</comment>
15731574
</data>
15741575
<data name="ID0450" xml:space="preserve">
15751576
<value>An HTTP redirect_uri or post_logout_redirect_uri cannot be used when using AS web authentication sessions. Make sure you're using a custom protocol scheme for all the callback URIs attached to the client registration. Alternatively, you can register an associated domain and use an HTTPS redirect_uri or post_logout_redirect_uri pointing to that domain (supported only on iOS 17.4+, Mac Catalyst 17.4+ and macOS 14.4+).</value>
@@ -1578,7 +1579,7 @@ To apply post-logout redirection responses, create a class implementing 'IOpenId
15781579
<value>The Zoho integration requires sending the region of the server when using the client credentials or refresh token grants. For that, attach a ".location" authentication property containing the region to use.</value>
15791580
</data>
15801581
<data name="ID0452" xml:space="preserve">
1581-
<value>Custom tabs intents are only supported on Android.</value>
1582+
<value>Custom tabs intents are only supported on Android and require using an OS-specific target framework moniker (e.g 'net8.0-android34.0').</value>
15821583
</data>
15831584
<data name="ID0453" xml:space="preserve">
15841585
<value>The specified intent doesn't contain a valid data URI.</value>

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,6 @@ public void PostConfigure(string? name, OpenIddictClientSystemIntegrationOptions
8383
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389));
8484
}
8585

86-
#if !SUPPORTS_ANDROID
87-
// When running on Android, iOS, Mac Catalyst or macOS, ensure the version compiled for
88-
// these platforms is used to prevent the generic/non-OS specific TFM from being used.
89-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("android")))
90-
{
91-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
92-
}
93-
#endif
94-
#if !SUPPORTS_APPKIT
95-
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
96-
{
97-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
98-
}
99-
#endif
100-
#if !SUPPORTS_UIKIT
101-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ios")) ||
102-
RuntimeInformation.IsOSPlatform(OSPlatform.Create("maccatalyst")))
103-
{
104-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
105-
}
106-
#endif
107-
10886
#if SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
10987
// Ensure the operating system version is supported.
11088
if ((OperatingSystem.IsAndroid() && !OperatingSystem.IsAndroidVersionAtLeast(21)) ||

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@ public static OpenIddictClientSystemIntegrationBuilder UseSystemIntegration(this
4242
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389));
4343
}
4444

45-
#if !SUPPORTS_ANDROID
46-
// When running on Android, iOS, Mac Catalyst or macOS, ensure the version compiled for
47-
// these platforms is used to prevent the generic/non-OS specific TFM from being used.
48-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("android")))
49-
{
50-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
51-
}
52-
#endif
53-
#if !SUPPORTS_APPKIT
54-
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
55-
{
56-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
57-
}
58-
#endif
59-
#if !SUPPORTS_UIKIT
60-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ios")) ||
61-
RuntimeInformation.IsOSPlatform(OSPlatform.Create("maccatalyst")))
62-
{
63-
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449));
64-
}
65-
#endif
66-
6745
#if SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
6846
// Ensure the operating system version is supported.
6947
if ((OperatingSystem.IsAndroid() && !OperatingSystem.IsAndroidVersionAtLeast(21)) ||

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ internal static bool IsWindowsVersionAtLeast(int major, int minor = 0, int build
110110
[SupportedOSPlatformGuard("maccatalyst13.1")]
111111
[SupportedOSPlatformGuard("macos10.15")]
112112
internal static bool IsASWebAuthenticationSessionSupported()
113-
#if SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
113+
#if SUPPORTS_AUTHENTICATION_SERVICES && SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
114114
=> OperatingSystem.IsIOSVersionAtLeast(12) ||
115115
OperatingSystem.IsMacCatalystVersionAtLeast(13) ||
116116
OperatingSystem.IsMacOSVersionAtLeast(10, 15);
@@ -125,7 +125,7 @@ internal static bool IsASWebAuthenticationSessionSupported()
125125
[MethodImpl(MethodImplOptions.AggressiveInlining)]
126126
[SupportedOSPlatformGuard("android21.0")]
127127
internal static bool IsCustomTabsIntentSupported()
128-
#if SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
128+
#if SUPPORTS_ANDROIDX_BROWSER && SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
129129
=> OperatingSystem.IsAndroidVersionAtLeast(21);
130130
#else
131131
=> false;
@@ -143,7 +143,12 @@ internal static bool IsCustomTabsIntentSupported()
143143
// guard that will prevent the WinRT projections from being loaded by the runtime on
144144
// platforms that don't support it. Since OpenIddict declares Windows 10 1809 as the
145145
// oldest supported version in the package, it is also used for the runtime check.
146-
internal static bool IsWindowsRuntimeSupported() => IsWindowsVersionAtLeast(10, 0, 17763);
146+
internal static bool IsWindowsRuntimeSupported()
147+
#if SUPPORTS_WINDOWS_RUNTIME
148+
=> IsWindowsVersionAtLeast(10, 0, 17763);
149+
#else
150+
=> false;
151+
#endif
147152

148153
/// <summary>
149154
/// Determines whether WinRT app instance activation is supported on this platform.

0 commit comments

Comments
 (0)