Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion GrandNode.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<Folder Name="/Plugins/">
<Project Path="src/Plugins/Authentication.Facebook/Authentication.Facebook.csproj" />
<Project Path="src/Plugins/Authentication.Google/Authentication.Google.csproj" />
<Project Path="src/Plugins/Authentication.OpenIdConnect/Authentication.OpenIdConnect.csproj" />
<Project Path="src/Plugins/DiscountRules.Standard/DiscountRules.Standard.csproj" />
<Project Path="src/Plugins/ExchangeRate.McExchange/ExchangeRate.McExchange.csproj" />
<Project Path="src/Plugins/Payments.BrainTree/Payments.BrainTree.csproj" />
Expand Down
67 changes: 31 additions & 36 deletions docs/oidc-resource-server.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Grand.Infrastructure.Configuration;
using Grand.Infrastructure.Plugins;

namespace Grand.Business.Authentication.Services;

Expand All @@ -9,17 +8,12 @@ namespace Grand.Business.Authentication.Services;
/// </summary>
public static class OidcSignInModeCheck
{
public static string Problem(OidcLoginConfig config, OidcResourceServerConfig resourceServer,
IEnumerable<PluginInfo> plugins)
public static string Problem(OidcLoginConfig config, OidcResourceServerConfig resourceServer)
{
if (config is not { ProviderOnly: true })
return null;
if (!config.IsConfigured(resourceServer))
return "OidcResourceServer:Authority or OidcLogin:ClientId is empty";
if (plugins?.Any(x => x.Installed &&
string.Equals(x.SystemName, OidcCustomerResolver.ProviderSystemName,
StringComparison.OrdinalIgnoreCase)) != true)
return "the OpenID Connect login plugin is not installed";
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Grand.Business.Authentication.Services;

/// <summary>
/// OidcLogin:SsoOnly - an account connected to the identity provider with its password (a link not made by e-mail)
/// signs in only through the provider, while the OpenID Connect login is installed, active and configured; a user
/// signs in only through the provider, while the OpenID Connect login is configured and active; a user
/// disabled at the provider then cannot use a GrandNode password either. Accounts without such a link keep the
/// password: the break-glass account, and accounts still to be connected.
/// OidcLogin:SignInMode = ProviderOnly - every account signs in through the provider; the password stays only for
Expand Down Expand Up @@ -81,7 +81,7 @@ private void LogUnavailable()
if (memoryCache.TryGetValue(UnavailableLogKey, out _))
return;
memoryCache.Set(UnavailableLogKey, true, TimeSpan.FromMinutes(5));
logger.LogError("ProviderOnly sign-in mode without a working OpenID Connect login (plugin not installed, " +
"not active or not configured): only break-glass accounts can sign in");
logger.LogError("ProviderOnly sign-in mode without a working OpenID Connect login (not configured or not " +
"active): only break-glass accounts can sign in");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Grand.Business.Core.Interfaces.Authentication;
using Grand.Infrastructure;
using Grand.Infrastructure.Configuration;
using Grand.Infrastructure.Plugins;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -32,7 +31,7 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
public void Configure(WebApplication application, IWebHostEnvironment webHostEnvironment)
{
var problem = OidcSignInModeCheck.Problem(application.Services.GetService<OidcLoginConfig>(),
application.Services.GetService<OidcResourceServerConfig>(), PluginManager.ReferencedPlugins);
application.Services.GetService<OidcResourceServerConfig>());
if (problem != null)
application.Services.GetRequiredService<ILogger<OidcSsoSignInPolicy>>().LogError(
"ProviderOnly sign-in mode without a working OpenID Connect login ({Problem}): only break-glass accounts can sign in",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Grand.Business.Core.Interfaces.Authentication;

/// <summary>
/// Exchanges a refresh token at the identity provider (implemented by the OpenID Connect login plugin; with no
/// Exchanges a refresh token at the identity provider (registered while the OpenID Connect sign-in is configured; with no
/// implementation registered a session cannot be confirmed and ends)
/// </summary>
public interface IOidcTokenRefresher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class OidcLoginConfig
public string ClientSecret { get; set; }
public string Scopes { get; set; } = "openid profile email offline_access";

/// <summary>Order of the sign-in button among the external authentication methods</summary>
public int DisplayOrder { get; set; }

/// <summary>A back-office session ends after this much inactivity (sliding)</summary>
public int StaffIdleTimeoutMinutes { get; set; } = DefaultStaffIdleTimeoutMinutes;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/Plugins/Authentication.OpenIdConnect/Manifest.cs

This file was deleted.

This file was deleted.

89 changes: 0 additions & 89 deletions src/Plugins/Authentication.OpenIdConnect/OidcLoginPlugin.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/Plugins/Authentication.OpenIdConnect/OidcLoginSettings.cs

This file was deleted.

Loading
Loading