diff --git a/src/OpenIddict.Abstractions/OpenIddictResources.resx b/src/OpenIddict.Abstractions/OpenIddictResources.resx index 8b085159..6a194379 100644 --- a/src/OpenIddict.Abstractions/OpenIddictResources.resx +++ b/src/OpenIddict.Abstractions/OpenIddictResources.resx @@ -1680,6 +1680,9 @@ To apply post-logout redirection responses, create a class implementing 'IOpenId An unknown error occurred while trying to start an AS web authentication session. + + 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'). + The security token is missing. diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs index 8f6e3b20..98b58713 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs @@ -83,6 +83,15 @@ public sealed class OpenIddictClientSystemIntegrationConfiguration : IConfigureO throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389)); } +#if !SUPPORTS_APPKIT && !SUPPORTS_UIKIT + // When running on iOS, Mac Catalyst or macOS, ensure the version compiled for these platforms is used. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ios")) || + RuntimeInformation.IsOSPlatform(OSPlatform.Create("maccatalyst")) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449)); + } +#endif #pragma warning disable CA1416 // If explicitly set, ensure the specified authentication mode is supported. if (options.AuthenticationMode is OpenIddictClientSystemIntegrationAuthenticationMode.ASWebAuthenticationSession && diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs index 51b02726..08c3f45f 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs @@ -40,6 +40,15 @@ public static class OpenIddictClientSystemIntegrationExtensions throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389)); } +#if !SUPPORTS_APPKIT && !SUPPORTS_UIKIT + // When running on iOS, Mac Catalyst or macOS, ensure the version compiled for these platforms is used. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ios")) || + RuntimeInformation.IsOSPlatform(OSPlatform.Create("maccatalyst")) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0449)); + } +#endif // Note: the OpenIddict activation handler service is deliberately registered as early as possible to // ensure protocol activations can be handled before another service can stop the initialization of the // application (e.g Dapplo.Microsoft.Extensions.Hosting.AppServices relies on an IHostedService to implement