Browse Source

Generate access types and durations constants for the Aliba, Google, Huawei, MusicBrainz, Reddit and Zoho providers

pull/2352/head
Kévin Chalet 8 months ago
parent
commit
a72febd75c
  1. 3
      sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs
  2. 5
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs
  3. 5
      sandbox/OpenIddict.Sandbox.Console.Client/Program.cs
  4. 18
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

3
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);
});
});

5
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

5
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]")

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

@ -99,6 +99,9 @@
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0473)) }}" />
<Constant Class="AccessTypes" Value="offline" Name="Offline" />
<Constant Class="AccessTypes" Value="online" Name="Online" />
<Constant Class="Regions" Value="China" Name="China" />
<Constant Class="Regions" Value="Global" Name="Global" />
@ -1089,6 +1092,9 @@
Documentation="https://developers.google.com/identity/protocols/oauth2/openid-connect">
<Environment Issuer="https://accounts.google.com/" />
<Constant Class="AccessTypes" Value="offline" Name="Offline" />
<Constant Class="AccessTypes" Value="online" Name="Online" />
<Setting PropertyName="AccessType" ParameterName="type" Type="String" Required="false"
Description="The value used as the 'access_type' parameter (can be set to 'offline' to retrieve a refresh token)" />
</Provider>
@ -1126,6 +1132,9 @@
<Environment Issuer="https://accounts.huawei.com/"
ConfigurationEndpoint="https://oauth-login.cloud.huawei.com/.well-known/openid-configuration" />
<Constant Class="AccessTypes" Value="offline" Name="Offline" />
<Constant Class="AccessTypes" Value="online" Name="Online" />
<Setting PropertyName="AccessType" ParameterName="type" Type="String" Required="false"
Description="The value used as the 'access_type' parameter (can be set to 'offline' to retrieve a refresh token)" />
@ -1566,6 +1575,9 @@
<Scope Name="profile" Default="true" Required="true" />
</Environment>
<Constant Class="AccessTypes" Value="offline" Name="Offline" />
<Constant Class="AccessTypes" Value="online" Name="Online" />
<Setting PropertyName="AccessType" ParameterName="type" Type="String" Required="false"
Description="The value used as the 'access_type' parameter (can be set to 'offline' to retrieve a refresh token)" />
@ -1844,6 +1856,9 @@
<Scope Name="identity" Default="true" Required="true" />
</Environment>
<Constant Class="Durations" Value="permanent" Name="Permanent" />
<Constant Class="Durations" Value="temporary" Name="Temporary" />
<Setting PropertyName="Duration" ParameterName="duration" Type="String" Required="false"
Description="The value used as the 'duration' parameter (can be set to 'permanent' to retrieve a refresh token)" />
</Provider>
@ -2707,6 +2722,9 @@
<Scope Name="AaaServer.profile.READ" Default="true" Required="true" />
</Environment>
<Constant Class="AccessTypes" Value="offline" Name="Offline" />
<Constant Class="AccessTypes" Value="online" Name="Online" />
<Constant Class="Regions" Value="Australia" Name="Australia" />
<Constant Class="Regions" Value="Canada" Name="Canada" />
<Constant Class="Regions" Value="European Union" Name="EuropeanUnion" />

Loading…
Cancel
Save