From a72febd75c6d2af0cc039e61545994148d91adcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Fri, 13 Jun 2025 09:08:33 +0200 Subject: [PATCH] Generate access types and durations constants for the Aliba, Google, Huawei, MusicBrainz, Reddit and Zoho providers --- .../Startup.cs | 3 ++- .../Startup.cs | 5 +++-- .../Program.cs | 5 +++-- ...OpenIddictClientWebIntegrationProviders.xml | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs index 8cd8315c..7e7932e0 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs @@ -9,6 +9,7 @@ using Microsoft.Owin.Host.SystemWeb; using Microsoft.Owin.Security.Cookies; using OpenIddict.Client; using OpenIddict.Client.Owin; +using OpenIddict.Client.WebIntegration; using OpenIddict.Sandbox.AspNetCore.Server.Models; using Owin; using static OpenIddict.Abstractions.OpenIddictConstants; @@ -95,7 +96,7 @@ public class Startup options.SetClientId("1016114395689-kgtgq2p6dj27d7v6e2kjkoj54dgrrckh.apps.googleusercontent.com") .SetClientSecret("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") .SetRedirectUri("callback/login/google") - .SetAccessType("offline") + .SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline) .AddScopes(Scopes.Profile); }); }); diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs index 983185b1..53115126 100644 --- a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using OpenIddict.Client; +using OpenIddict.Client.WebIntegration; using OpenIddict.Sandbox.AspNetCore.Client.Models; using Quartz; using static OpenIddict.Abstractions.OpenIddictConstants; @@ -152,7 +153,7 @@ public class Startup options.SetClientId("1016114395689-kgtgq2p6dj27d7v6e2kjkoj54dgrrckh.apps.googleusercontent.com") .SetClientSecret("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") .SetRedirectUri("callback/login/google") - .SetAccessType("offline") + .SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline) .AddScopes(Scopes.Profile); }) .AddReddit(options => @@ -160,7 +161,7 @@ public class Startup options.SetClientId("vDLNqhrkwrvqHgnoBWF3og") .SetClientSecret("Tpab28Dz0upyZLqn7AN3GFD1O-zaAw") .SetRedirectUri("callback/login/reddit") - .SetDuration("permanent"); + .SetDuration(OpenIddictClientWebIntegrationConstants.Reddit.Durations.Permanent); }); #if SUPPORTS_PEM_ENCODED_KEY_IMPORT diff --git a/sandbox/OpenIddict.Sandbox.Console.Client/Program.cs b/sandbox/OpenIddict.Sandbox.Console.Client/Program.cs index e42f6c6b..56b0a82c 100644 --- a/sandbox/OpenIddict.Sandbox.Console.Client/Program.cs +++ b/sandbox/OpenIddict.Sandbox.Console.Client/Program.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using OpenIddict.Client; +using OpenIddict.Client.WebIntegration; using OpenIddict.Sandbox.Console.Client; using static OpenIddict.Abstractions.OpenIddictConstants; @@ -104,7 +105,7 @@ builder.Services.AddOpenIddict() // is discouraged practice, it is the only option to use this provider in a desktop client. .SetClientSecret("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") .SetRedirectUri("callback/login/google") - .SetAccessType("offline") + .SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline) .AddScopes(Scopes.Profile) .AddGrantTypes(GrantTypes.AuthorizationCode) .SetProviderName("Google [code flow]") @@ -115,7 +116,7 @@ builder.Services.AddOpenIddict() options.SetClientId("1016114395689-le5kvnikv5hhg3otvn1tgs2aogpkpvff.apps.googleusercontent.com") .SetClientSecret("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") .SetRedirectUri("callback/login/google") - .SetAccessType("offline") + .SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline) .AddScopes(Scopes.Profile) .AddGrantTypes(GrantTypes.DeviceCode) .SetProviderName("Google [device flow]") diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 0ad5422d..0e6510f3 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -99,6 +99,9 @@ _ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0473)) }}" /> + + + @@ -1089,6 +1092,9 @@ Documentation="https://developers.google.com/identity/protocols/oauth2/openid-connect"> + + + @@ -1126,6 +1132,9 @@ + + + @@ -1566,6 +1575,9 @@ + + + @@ -1844,6 +1856,9 @@ + + + @@ -2707,6 +2722,9 @@ + + +