Browse Source

Add Dailymotion to the list of supported providers

pull/2003/head
Kévin Chalet 2 years ago
parent
commit
7aac102830
  1. 6
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreExtensions.cs
  2. 6
      src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionExtensions.cs
  3. 6
      src/OpenIddict.Client.Owin/OpenIddictClientOwinExtensions.cs
  4. 6
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs
  5. 6
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpExtensions.cs
  6. 6
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationExtensions.cs
  7. 11
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs
  8. 36
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  9. 55
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml
  10. 1
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd
  11. 6
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreExtensions.cs
  12. 6
      src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionExtensions.cs
  13. 6
      src/OpenIddict.Server.Owin/OpenIddictServerOwinExtensions.cs
  14. 6
      src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreExtensions.cs
  15. 6
      src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionExtensions.cs
  16. 6
      src/OpenIddict.Validation.Owin/OpenIddictValidationOwinExtensions.cs
  17. 6
      src/OpenIddict.Validation.ServerIntegration/OpenIddictValidationServerIntegrationExtensions.cs
  18. 6
      src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs
  19. 2
      test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs

6
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreExtensions.cs

@ -48,14 +48,14 @@ public static class OpenIddictClientAspNetCoreExtensions
// Register the option initializer used by the OpenIddict ASP.NET Core client integration services. // Register the option initializer used by the OpenIddict ASP.NET Core client integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictClientAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictClientAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictClientAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictClientAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientAspNetCoreOptions>, OpenIddictClientAspNetCoreConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientAspNetCoreOptions>, OpenIddictClientAspNetCoreConfiguration>()
}); ]);
return new OpenIddictClientAspNetCoreBuilder(builder.Services); return new OpenIddictClientAspNetCoreBuilder(builder.Services);
} }

6
src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionExtensions.cs

@ -40,11 +40,11 @@ public static class OpenIddictClientDataProtectionExtensions
builder.Services.TryAddSingleton<RequireDataProtectionTokenFormat>(); builder.Services.TryAddSingleton<RequireDataProtectionTokenFormat>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientDataProtectionConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientDataProtectionConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientDataProtectionOptions>, OpenIddictClientDataProtectionConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientDataProtectionOptions>, OpenIddictClientDataProtectionConfiguration>()
}); ]);
return new OpenIddictClientDataProtectionBuilder(builder.Services); return new OpenIddictClientDataProtectionBuilder(builder.Services);
} }

6
src/OpenIddict.Client.Owin/OpenIddictClientOwinExtensions.cs

@ -49,11 +49,11 @@ public static class OpenIddictClientOwinExtensions
// Register the option initializer used by the OpenIddict OWIN client integration services. // Register the option initializer used by the OpenIddict OWIN client integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientOwinConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientOwinConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientOwinOptions>, OpenIddictClientOwinConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientOwinOptions>, OpenIddictClientOwinConfiguration>()
}); ]);
return new OpenIddictClientOwinBuilder(builder.Services); return new OpenIddictClientOwinBuilder(builder.Services);
} }

6
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs

@ -72,8 +72,8 @@ public static class OpenIddictClientSystemIntegrationExtensions
// Register the option initializer and the background service used by the OpenIddict client system integration services. // Register the option initializer and the background service used by the OpenIddict client system integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers and the background service are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers and the background service are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IHostedService, OpenIddictClientSystemIntegrationHttpListener>(), ServiceDescriptor.Singleton<IHostedService, OpenIddictClientSystemIntegrationHttpListener>(),
ServiceDescriptor.Singleton<IHostedService, OpenIddictClientSystemIntegrationPipeListener>(), ServiceDescriptor.Singleton<IHostedService, OpenIddictClientSystemIntegrationPipeListener>(),
@ -81,7 +81,7 @@ public static class OpenIddictClientSystemIntegrationExtensions
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientOptions>, OpenIddictClientSystemIntegrationConfiguration>(), ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientOptions>, OpenIddictClientSystemIntegrationConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientSystemIntegrationOptions>, OpenIddictClientSystemIntegrationConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictClientSystemIntegrationOptions>, OpenIddictClientSystemIntegrationConfiguration>()
}); ]);
return new OpenIddictClientSystemIntegrationBuilder(builder.Services); return new OpenIddictClientSystemIntegrationBuilder(builder.Services);
} }

6
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpExtensions.cs

@ -40,11 +40,11 @@ public static class OpenIddictClientSystemNetHttpExtensions
builder.Services.TryAddSingleton<RequireHttpMetadataUri>(); builder.Services.TryAddSingleton<RequireHttpMetadataUri>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientSystemNetHttpConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientSystemNetHttpConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<HttpClientFactoryOptions>, OpenIddictClientSystemNetHttpConfiguration>() ServiceDescriptor.Singleton<IConfigureOptions<HttpClientFactoryOptions>, OpenIddictClientSystemNetHttpConfiguration>()
}); ]);
return new OpenIddictClientSystemNetHttpBuilder(builder.Services); return new OpenIddictClientSystemNetHttpBuilder(builder.Services);
} }

6
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationExtensions.cs

@ -39,11 +39,11 @@ public static partial class OpenIddictClientWebIntegrationExtensions
.Select(descriptor => descriptor.ServiceDescriptor)); .Select(descriptor => descriptor.ServiceDescriptor));
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientWebIntegrationConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientOptions>, OpenIddictClientWebIntegrationConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientSystemNetHttpOptions>, OpenIddictClientWebIntegrationConfiguration>() ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictClientSystemNetHttpOptions>, OpenIddictClientWebIntegrationConfiguration>()
}); ]);
// Note: the IPostConfigureOptions<OpenIddictClientOptions> service responsible for populating // Note: the IPostConfigureOptions<OpenIddictClientOptions> service responsible for populating
// the client registrations MUST be registered before OpenIddictClientConfiguration to ensure // the client registrations MUST be registered before OpenIddictClientConfiguration to ensure

11
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs

@ -11,6 +11,7 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Text; using System.Text;
using System.Text.Json;
using OpenIddict.Extensions; using OpenIddict.Extensions;
using static OpenIddict.Client.SystemNetHttp.OpenIddictClientSystemNetHttpConstants; using static OpenIddict.Client.SystemNetHttp.OpenIddictClientSystemNetHttpConstants;
using static OpenIddict.Client.SystemNetHttp.OpenIddictClientSystemNetHttpHandlerFilters; using static OpenIddict.Client.SystemNetHttp.OpenIddictClientSystemNetHttpHandlerFilters;
@ -356,6 +357,16 @@ public static partial class OpenIddictClientWebIntegrationHandlers
return default; return default;
} }
// Note: when using the client credentials grant, Dailymotion returns a "refresh_token"
// node with a JSON null value, which isn't allowed by OpenIddict (that requires a string).
//
// To work around that, the "refresh_token" node is removed when it is set to a null value .
if (context.Registration.ProviderType is ProviderTypes.Dailymotion && (JsonElement?)
context.Response[Parameters.RefreshToken] is { ValueKind: JsonValueKind.Null })
{
context.Response.RefreshToken = null;
}
// Note: Deezer doesn't return a standard "expires_in" parameter // Note: Deezer doesn't return a standard "expires_in" parameter
// but returns an equivalent "expires" integer parameter instead. // but returns an equivalent "expires" integer parameter instead.
if (context.Registration.ProviderType is ProviderTypes.Deezer) if (context.Registration.ProviderType is ProviderTypes.Deezer)

36
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs

@ -686,6 +686,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.UserinfoEndpoint = context.Registration.ProviderType switch context.UserinfoEndpoint = context.Registration.ProviderType switch
{ {
// Dailymotion's userinfo endpoint requires sending the user identifier in the URI path.
ProviderTypes.Dailymotion when (string?) context.TokenResponse?["uid"] is string identifier
=> OpenIddictHelpers.CreateAbsoluteUri(
left : new Uri("https://api.dailymotion.com/user", UriKind.Absolute),
right: new Uri(identifier, UriKind.Relative)),
// HubSpot doesn't have a static userinfo endpoint but allows retrieving basic information // HubSpot doesn't have a static userinfo endpoint but allows retrieving basic information
// by using an access token info endpoint that requires sending the token in the URI path. // by using an access token info endpoint that requires sending the token in the URI path.
ProviderTypes.HubSpot when ProviderTypes.HubSpot when
@ -852,10 +858,20 @@ public static partial class OpenIddictClientWebIntegrationHandlers
Debug.Assert(context.UserinfoRequest is not null, SR.GetResourceString(SR.ID4008)); Debug.Assert(context.UserinfoRequest is not null, SR.GetResourceString(SR.ID4008));
// Dailymotion limits the number of fields returned by the userinfo endpoint
// but allows returning additional information using special parameters that
// determine what fields will be returned as part of the userinfo response.
if (context.Registration.ProviderType is ProviderTypes.Dailymotion)
{
var settings = context.Registration.GetDailymotionSettings();
context.UserinfoRequest["fields"] = string.Join(",", settings.UserFields);
}
// Facebook limits the number of fields returned by the userinfo endpoint // Facebook limits the number of fields returned by the userinfo endpoint
// but allows returning additional information using special parameters that // but allows returning additional information using special parameters that
// determine what fields will be returned as part of the userinfo response. // determine what fields will be returned as part of the userinfo response.
if (context.Registration.ProviderType is ProviderTypes.Facebook) else if (context.Registration.ProviderType is ProviderTypes.Facebook)
{ {
var settings = context.Registration.GetFacebookSettings(); var settings = context.Registration.GetFacebookSettings();
@ -1084,9 +1100,9 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.MergedPrincipal.SetClaim(ClaimTypes.Name, issuer: issuer, value: context.Registration.ProviderType switch context.MergedPrincipal.SetClaim(ClaimTypes.Name, issuer: issuer, value: context.Registration.ProviderType switch
{ {
// These providers return the username as a custom "username" node: // These providers return the username as a custom "username" node:
ProviderTypes.ArcGisOnline or ProviderTypes.Discord or ProviderTypes.DeviantArt or ProviderTypes.ArcGisOnline or ProviderTypes.Dailymotion or ProviderTypes.Discord or
ProviderTypes.Lichess or ProviderTypes.Mixcloud or ProviderTypes.Trakt or ProviderTypes.DeviantArt or ProviderTypes.Lichess or ProviderTypes.Mixcloud or
ProviderTypes.WordPress ProviderTypes.Trakt or ProviderTypes.WordPress
=> (string?) context.UserinfoResponse?["username"], => (string?) context.UserinfoResponse?["username"],
// Basecamp and Harvest don't return a username so one is created using the "first_name" and "last_name" nodes: // Basecamp and Harvest don't return a username so one is created using the "first_name" and "last_name" nodes:
@ -1166,12 +1182,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
=> (string?) context.UserinfoResponse?["username"], => (string?) context.UserinfoResponse?["username"],
// These providers return the user identifier as a custom "id" node: // These providers return the user identifier as a custom "id" node:
ProviderTypes.Basecamp or ProviderTypes.Deezer or ProviderTypes.Discord or ProviderTypes.Basecamp or ProviderTypes.Dailymotion or ProviderTypes.Deezer or
ProviderTypes.Facebook or ProviderTypes.GitHub or ProviderTypes.Harvest or ProviderTypes.Discord or ProviderTypes.Facebook or ProviderTypes.GitHub or
ProviderTypes.Kroger or ProviderTypes.Lichess or ProviderTypes.Nextcloud or ProviderTypes.Harvest or ProviderTypes.Kroger or ProviderTypes.Lichess or
ProviderTypes.Patreon or ProviderTypes.Reddit or ProviderTypes.Smartsheet or ProviderTypes.Nextcloud or ProviderTypes.Patreon or ProviderTypes.Reddit or
ProviderTypes.Spotify or ProviderTypes.SubscribeStar or ProviderTypes.Twitter or ProviderTypes.Smartsheet or ProviderTypes.Spotify or ProviderTypes.SubscribeStar or
ProviderTypes.Zoom ProviderTypes.Twitter or ProviderTypes.Zoom
=> (string?) context.UserinfoResponse?["id"], => (string?) context.UserinfoResponse?["id"],
// Bitbucket returns the user identifier as a custom "uuid" node: // Bitbucket returns the user identifier as a custom "uuid" node:

55
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

@ -263,6 +263,61 @@
Description="The User Pool ID" /> Description="The User Pool ID" />
</Provider> </Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▄▀█ ▄▄▀█▄ ▄██ █████ ███ ██ ▄▀▄ ██ ▄▄▄ █▄▄ ▄▄█▄ ▄██ ▄▄▄ ██ ▀██ ██
██ ██ █ ▀▀ ██ ███ █████▄▀▀▀▄██ █ █ ██ ███ ███ ████ ███ ███ ██ █ █ ██
██ ▀▀ █ ██ █▀ ▀██ ▀▀ ████ ████ ███ ██ ▀▀▀ ███ ███▀ ▀██ ▀▀▀ ██ ██▄ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<Provider Name="Dailymotion" Id="e289f3ca-6d1d-45f9-8be0-8a649cc4a700"
Documentation="https://developers.dailymotion.com/guides/platform-api-authentication/">
<Environment Issuer="https://api.dailymotion.com/">
<Configuration AuthorizationEndpoint="https://api.dailymotion.com/oauth/authorize"
TokenEndpoint="https://api.dailymotion.com/oauth/token">
<GrantType Value="authorization_code" />
<GrantType Value="client_credentials" />
<GrantType Value="password" />
<GrantType Value="refresh_token" />
</Configuration>
</Environment>
<Setting PropertyName="UserFields" ParameterName="fields" Collection="true" Type="String"
Description="The list of user fields to expand from the userinfo endpoint (by default, most common fields are requested)">
<Item Value="active" Default="true" Required="false" />
<Item Value="address" Default="true" Required="false" />
<Item Value="birthday" Default="true" Required="false" />
<Item Value="city" Default="true" Required="false" />
<Item Value="country" Default="true" Required="false" />
<Item Value="cover_url" Default="true" Required="false" />
<Item Value="created_time" Default="true" Required="false" />
<Item Value="email" Default="true" Required="false" />
<Item Value="facebook_url" Default="true" Required="false" />
<Item Value="first_name" Default="true" Required="false" />
<Item Value="followers_total" Default="true" Required="false" />
<Item Value="following_total" Default="true" Required="false" />
<Item Value="fullname" Default="true" Required="false" />
<Item Value="gender" Default="true" Required="false" />
<Item Value="id" Default="true" Required="false" />
<Item Value="instagram_url" Default="true" Required="false" />
<Item Value="language" Default="true" Required="false" />
<Item Value="last_name" Default="true" Required="false" />
<Item Value="linkedin_url" Default="true" Required="false" />
<Item Value="nickname" Default="true" Required="false" />
<Item Value="pinterest_url" Default="true" Required="false" />
<Item Value="screenname" Default="true" Required="false" />
<Item Value="status" Default="true" Required="false" />
<Item Value="twitter_url" Default="true" Required="false" />
<Item Value="url" Default="true" Required="false" />
<Item Value="username" Default="true" Required="false" />
<Item Value="verified" Default="true" Required="false" />
<Item Value="videos_total" Default="true" Required="false" />
<Item Value="views_total" Default="true" Required="false" />
<Item Value="website_url" Default="true" Required="false" />
</Setting>
</Provider>
<!-- <!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▄▀██ ▄▄▄██ ▄▄▄██ ▄▄▄ ██ ▄▄▄██ ▄▄▀██ ██ ▄▄▀██ ▄▄▄██ ▄▄▄██ ▄▄▄ ██ ▄▄▄██ ▄▄▀██

1
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd

@ -87,6 +87,7 @@
<xs:enumeration value="authorization_code" /> <xs:enumeration value="authorization_code" />
<xs:enumeration value="client_credentials" /> <xs:enumeration value="client_credentials" />
<xs:enumeration value="implicit" /> <xs:enumeration value="implicit" />
<xs:enumeration value="password" />
<xs:enumeration value="refresh_token" /> <xs:enumeration value="refresh_token" />
<xs:enumeration value="urn:ietf:params:oauth:grant-type:device_code" /> <xs:enumeration value="urn:ietf:params:oauth:grant-type:device_code" />
</xs:restriction> </xs:restriction>

6
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreExtensions.cs

@ -52,15 +52,15 @@ public static class OpenIddictServerAspNetCoreExtensions
// Register the option initializer used by the OpenIddict ASP.NET Core server integration services. // Register the option initializer used by the OpenIddict ASP.NET Core server integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictServerAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictServerAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictServerAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictServerAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerAspNetCoreOptions>, OpenIddictServerAspNetCoreConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerAspNetCoreOptions>, OpenIddictServerAspNetCoreConfiguration>()
}); ]);
return new OpenIddictServerAspNetCoreBuilder(builder.Services); return new OpenIddictServerAspNetCoreBuilder(builder.Services);
} }

6
src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionExtensions.cs

@ -40,11 +40,11 @@ public static class OpenIddictServerDataProtectionExtensions
builder.Services.TryAddSingleton<RequireDataProtectionTokenFormat>(); builder.Services.TryAddSingleton<RequireDataProtectionTokenFormat>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerDataProtectionConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerDataProtectionConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerDataProtectionOptions>, OpenIddictServerDataProtectionConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerDataProtectionOptions>, OpenIddictServerDataProtectionConfiguration>()
}); ]);
return new OpenIddictServerDataProtectionBuilder(builder.Services); return new OpenIddictServerDataProtectionBuilder(builder.Services);
} }

6
src/OpenIddict.Server.Owin/OpenIddictServerOwinExtensions.cs

@ -54,11 +54,11 @@ public static class OpenIddictServerOwinExtensions
// Register the option initializers used by the OpenIddict OWIN server integration services. // Register the option initializers used by the OpenIddict OWIN server integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerOwinConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictServerOptions>, OpenIddictServerOwinConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerOwinOptions>, OpenIddictServerOwinConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictServerOwinOptions>, OpenIddictServerOwinConfiguration>()
}); ]);
return new OpenIddictServerOwinBuilder(builder.Services); return new OpenIddictServerOwinBuilder(builder.Services);
} }

6
src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreExtensions.cs

@ -42,13 +42,13 @@ public static class OpenIddictValidationAspNetCoreExtensions
// Register the option initializer used by the OpenIddict ASP.NET Core validation integration services. // Register the option initializer used by the OpenIddict ASP.NET Core validation integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictValidationAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<AuthenticationOptions>, OpenIddictValidationAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictValidationAspNetCoreConfiguration>(), ServiceDescriptor.Singleton<IPostConfigureOptions<AuthenticationOptions>, OpenIddictValidationAspNetCoreConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationAspNetCoreConfiguration>() ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationAspNetCoreConfiguration>()
}); ]);
return new OpenIddictValidationAspNetCoreBuilder(builder.Services); return new OpenIddictValidationAspNetCoreBuilder(builder.Services);
} }

6
src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionExtensions.cs

@ -36,11 +36,11 @@ public static class OpenIddictValidationDataProtectionExtensions
builder.Services.TryAdd(OpenIddictValidationDataProtectionHandlers.DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor)); builder.Services.TryAdd(OpenIddictValidationDataProtectionHandlers.DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor));
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationDataProtectionConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationDataProtectionConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictValidationDataProtectionOptions>, OpenIddictValidationDataProtectionConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictValidationDataProtectionOptions>, OpenIddictValidationDataProtectionConfiguration>()
}); ]);
return new OpenIddictValidationDataProtectionBuilder(builder.Services); return new OpenIddictValidationDataProtectionBuilder(builder.Services);
} }

6
src/OpenIddict.Validation.Owin/OpenIddictValidationOwinExtensions.cs

@ -43,10 +43,10 @@ public static class OpenIddictValidationOwinExtensions
// Register the option initializers used by the OpenIddict OWIN validation integration services. // Register the option initializers used by the OpenIddict OWIN validation integration services.
// Note: TryAddEnumerable() is used here to ensure the initializers are only registered once. // Note: TryAddEnumerable() is used here to ensure the initializers are only registered once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationOwinConfiguration>() ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationOwinConfiguration>()
}); ]);
return new OpenIddictValidationOwinBuilder(builder.Services); return new OpenIddictValidationOwinBuilder(builder.Services);
} }

6
src/OpenIddict.Validation.ServerIntegration/OpenIddictValidationServerIntegrationExtensions.cs

@ -31,11 +31,11 @@ public static class OpenIddictValidationServerIntegrationExtensions
} }
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationServerIntegrationConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationServerIntegrationConfiguration>(),
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationServerIntegrationConfiguration>() ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationServerIntegrationConfiguration>()
}); ]);
return new OpenIddictValidationServerIntegrationBuilder(builder.Services); return new OpenIddictValidationServerIntegrationBuilder(builder.Services);
} }

6
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs

@ -40,11 +40,11 @@ public static class OpenIddictValidationSystemNetHttpExtensions
builder.Services.TryAddSingleton<RequireHttpMetadataUri>(); builder.Services.TryAddSingleton<RequireHttpMetadataUri>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.
builder.Services.TryAddEnumerable(new[] builder.Services.TryAddEnumerable(
{ [
ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationSystemNetHttpConfiguration>(), ServiceDescriptor.Singleton<IConfigureOptions<OpenIddictValidationOptions>, OpenIddictValidationSystemNetHttpConfiguration>(),
ServiceDescriptor.Singleton<IConfigureOptions<HttpClientFactoryOptions>, OpenIddictValidationSystemNetHttpConfiguration>() ServiceDescriptor.Singleton<IConfigureOptions<HttpClientFactoryOptions>, OpenIddictValidationSystemNetHttpConfiguration>()
}); ]);
return new OpenIddictValidationSystemNetHttpBuilder(builder.Services); return new OpenIddictValidationSystemNetHttpBuilder(builder.Services);
} }

2
test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs

@ -1026,7 +1026,7 @@ public class OpenIddictExtensionsTests
[Theory] [Theory]
[InlineData(null)] [InlineData(null)]
[InlineData(new object[] { new string[0] })] [InlineData([new string[0]])]
public void Claim_SetDestinations_RemovesPropertyForEmptyArray(string[] destinations) public void Claim_SetDestinations_RemovesPropertyForEmptyArray(string[] destinations)
{ {
// Arrange // Arrange

Loading…
Cancel
Save