Merge pull request #2446 from sbwalker/dev
add upgrade logic for sites using remapped identifier and email claim…
This commit is contained in:
commit
e40bf08691
|
@ -602,14 +602,10 @@ else
|
||||||
if (_providertype == AuthenticationProviderTypes.OpenIDConnect)
|
if (_providertype == AuthenticationProviderTypes.OpenIDConnect)
|
||||||
{
|
{
|
||||||
_scopes = "openid,profile,email";
|
_scopes = "openid,profile,email";
|
||||||
_identifierclaimtype = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier";
|
|
||||||
_emailclaimtype = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_scopes = "";
|
_scopes = "";
|
||||||
_identifierclaimtype = "sub";
|
|
||||||
_emailclaimtype = "email";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_redirecturl = PageState.Uri.Scheme + "://" + PageState.Alias.Name + "/signin-" + _providertype;
|
_redirecturl = PageState.Uri.Scheme + "://" + PageState.Alias.Name + "/signin-" + _providertype;
|
||||||
|
|
|
@ -57,6 +57,9 @@ namespace Oqtane.Infrastructure
|
||||||
case "3.2.0":
|
case "3.2.0":
|
||||||
Upgrade_3_2_0(tenant, scope);
|
Upgrade_3_2_0(tenant, scope);
|
||||||
break;
|
break;
|
||||||
|
case "3.2.1":
|
||||||
|
Upgrade_3_2_1(tenant, scope);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,5 +267,41 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Upgrade_3_2_1(Tenant tenant, IServiceScope scope)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// convert Identifier Claim Type and Email Claim Type
|
||||||
|
var settingRepository = scope.ServiceProvider.GetRequiredService<ISettingRepository>();
|
||||||
|
var siteRepository = scope.ServiceProvider.GetRequiredService<ISiteRepository>();
|
||||||
|
foreach (Site site in siteRepository.GetSites().ToList())
|
||||||
|
{
|
||||||
|
var settings = settingRepository.GetSettings(EntityNames.Site, site.SiteId).ToList();
|
||||||
|
var setting = settings.FirstOrDefault(item => item.SettingName == "ExternalLogin:IdentifierClaimType");
|
||||||
|
if (setting != null)
|
||||||
|
{
|
||||||
|
if (setting.SettingValue == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")
|
||||||
|
{
|
||||||
|
setting.SettingValue = "sub";
|
||||||
|
settingRepository.UpdateSetting(setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setting = settings.FirstOrDefault(item => item.SettingName == "ExternalLogin:EmailClaimType");
|
||||||
|
if (setting != null)
|
||||||
|
{
|
||||||
|
if (setting.SettingValue == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress")
|
||||||
|
{
|
||||||
|
setting.SettingValue = "email";
|
||||||
|
settingRepository.UpdateSetting(setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"Oqtane Error: Error In 3.2.1 Upgrade Logic - {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user