diff --git a/src/VirtoCommerce.Platform.Security/ExternalSignin/ExternalSignInProviderConfiguration.cs b/src/VirtoCommerce.Platform.Security/ExternalSignin/ExternalSignInProviderConfiguration.cs index 3f4ba4970a2..ac568edc2d5 100644 --- a/src/VirtoCommerce.Platform.Security/ExternalSignin/ExternalSignInProviderConfiguration.cs +++ b/src/VirtoCommerce.Platform.Security/ExternalSignin/ExternalSignInProviderConfiguration.cs @@ -11,5 +11,10 @@ public class ExternalSignInProviderConfiguration /// Provider implementation /// public IExternalSignInProvider Provider { get; set; } + + /// + /// Provider logo url (ex '/Modules/$(ModuleId)/Content/provider-logo.png') + /// + public string LogoUrl { get; set; } } } diff --git a/src/VirtoCommerce.Platform.Web/Controllers/ExternalSignInController.cs b/src/VirtoCommerce.Platform.Web/Controllers/ExternalSignInController.cs index 54cacc6d9c2..ab7cc03d72e 100644 --- a/src/VirtoCommerce.Platform.Web/Controllers/ExternalSignInController.cs +++ b/src/VirtoCommerce.Platform.Web/Controllers/ExternalSignInController.cs @@ -1,12 +1,15 @@ +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using VirtoCommerce.Platform.Core.Common; using VirtoCommerce.Platform.Core.Events; using VirtoCommerce.Platform.Core.Security; using VirtoCommerce.Platform.Core.Security.Events; +using VirtoCommerce.Platform.Security.ExternalSignIn; using VirtoCommerce.Platform.Web.Model.Security; namespace VirtoCommerce.Platform.Web.Controllers @@ -17,14 +20,17 @@ public class ExternalSignInController : Controller private readonly SignInManager _signInManager; private readonly IExternalSigninService _externalSigninService; private readonly IEventPublisher _eventPublisher; + private readonly IEnumerable _externalSigninProviderConfigs; public ExternalSignInController(SignInManager signInManager, IExternalSigninService externalSigninService, - IEventPublisher eventPublisher) + IEventPublisher eventPublisher, + IEnumerable externalSigninProviderConfigs) { _signInManager = signInManager; _externalSigninService = externalSigninService; _eventPublisher = eventPublisher; + _externalSigninProviderConfigs = externalSigninProviderConfigs; } [HttpGet] @@ -80,7 +86,10 @@ public async Task> GetExternalLoginPr .Select(authenticationDescription => new ExternalSignInProviderInfo { AuthenticationType = authenticationDescription.Name, - DisplayName = authenticationDescription.DisplayName + DisplayName = authenticationDescription.DisplayName, + LogoUrl = _externalSigninProviderConfigs? + .FirstOrDefault(x => x.AuthenticationType.EqualsInvariant(authenticationDescription.Name))? + .LogoUrl, }) .ToArray(); diff --git a/src/VirtoCommerce.Platform.Web/Model/Security/ExternalSignInProviderInfo.cs b/src/VirtoCommerce.Platform.Web/Model/Security/ExternalSignInProviderInfo.cs index 06f43009c62..6a44d50d710 100644 --- a/src/VirtoCommerce.Platform.Web/Model/Security/ExternalSignInProviderInfo.cs +++ b/src/VirtoCommerce.Platform.Web/Model/Security/ExternalSignInProviderInfo.cs @@ -4,5 +4,6 @@ public class ExternalSignInProviderInfo { public string AuthenticationType { get; set; } public string DisplayName { get; set; } + public string LogoUrl { get; set; } } } diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/login/login.tpl.html b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/login/login.tpl.html index 393178fdd2b..b1bba93ef11 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/login/login.tpl.html +++ b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/login/login.tpl.html @@ -50,7 +50,7 @@

{{ 'platform.blades.login.labels.sign-in' | translate: (