commit
859759d691
|
@ -94,7 +94,6 @@ else
|
||||||
var language = new Language
|
var language = new Language
|
||||||
{
|
{
|
||||||
SiteId = PageState.Page.SiteId,
|
SiteId = PageState.Page.SiteId,
|
||||||
Name = CultureInfo.GetCultureInfo(_code).DisplayName,
|
|
||||||
Code = _code,
|
Code = _code,
|
||||||
IsDefault = (_default == null ? false : Boolean.Parse(_default))
|
IsDefault = (_default == null ? false : Boolean.Parse(_default))
|
||||||
};
|
};
|
||||||
|
@ -130,7 +129,7 @@ else
|
||||||
{
|
{
|
||||||
var interop = new Interop(JSRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||||
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
|
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360, true, "Lax");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ else
|
||||||
{
|
{
|
||||||
var interop = new Interop(JSRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||||
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
|
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360, true, "Lax");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ else
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Pager Items="@_pages.Where(item => item.IsDeleted)" CurrentPage="@_pagePage.ToString()" OnPageChange="OnPageChangePage">
|
<Pager Items="@_pages.Where(item => item.IsDeleted).OrderByDescending(item => item.DeletedOn)" CurrentPage="@_pagePage.ToString()" OnPageChange="OnPageChangePage">
|
||||||
<Header>
|
<Header>
|
||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
|
@ -50,7 +50,7 @@ else
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Pager Items="@_modules.Where(item => item.IsDeleted)" CurrentPage="@_pageModule.ToString()" OnPageChange="OnPageChangeModule">
|
<Pager Items="@_modules.Where(item => item.IsDeleted).OrderByDescending(item => item.DeletedOn)" CurrentPage="@_pageModule.ToString()" OnPageChange="OnPageChangeModule">
|
||||||
<Header>
|
<Header>
|
||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
|
|
|
@ -376,7 +376,7 @@
|
||||||
<Section Name="TenantInformation" Heading="Database" ResourceKey="TenantInformation">
|
<Section Name="TenantInformation" Heading="Database" ResourceKey="TenantInformation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="tenant" HelpText="The name of the database used for the site" ResourceKey="Tenant">Database: </Label>
|
<Label Class="col-sm-3" For="tenant" HelpText="The name of the database used for the site. Note that this is not the physical database name but rather the tenant name which is used within the framework to identify a database." ResourceKey="Tenant">Database: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||||
</div>
|
</div>
|
||||||
|
@ -388,7 +388,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="connectionstring" HelpText="The connection information for the database" ResourceKey="ConnectionString">Connection: </Label>
|
<Label Class="col-sm-3" For="connectionstring" HelpText="The name of the connection string in appsettings.json which will be used to connect to the database" ResourceKey="ConnectionString">Connection: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input id="connectionstring" class="form-control" @bind="@_connectionstring" readonly />
|
<input id="connectionstring" class="form-control" @bind="@_connectionstring" readonly />
|
||||||
</div>
|
</div>
|
||||||
|
@ -571,7 +571,7 @@
|
||||||
if (tenant != null)
|
if (tenant != null)
|
||||||
{
|
{
|
||||||
_tenant = tenant.Name;
|
_tenant = tenant.Name;
|
||||||
_database = _databases.Find(item => item.DBType == tenant.DBType)?.Name;
|
_database = _databases.Find(item => item.DBType == tenant.DBType && item.Name != "LocalDB")?.Name;
|
||||||
_connectionstring = tenant.DBConnectionString;
|
_connectionstring = tenant.DBConnectionString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ else
|
||||||
<hr class="app-rule" />
|
<hr class="app-rule" />
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="name" HelpText="Enter the name for the database" ResourceKey="TenantName">Name: </Label>
|
<Label Class="col-sm-3" For="name" HelpText="Enter the name for the database. Note that this will be the tenant name which is used within the framework to identify the database." ResourceKey="TenantName">Name: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input id="name" class="form-control" @bind="@_tenantName" maxlength="100" required />
|
<input id="name" class="form-control" @bind="@_tenantName" maxlength="100" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -83,23 +83,14 @@ else
|
||||||
{
|
{
|
||||||
@if (_connection != "-")
|
@if (_connection != "-")
|
||||||
{
|
{
|
||||||
|
@if (!string.IsNullOrEmpty(_tenant))
|
||||||
|
{
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="databasetype" HelpText="The database type" ResourceKey="DatabaseType">Type: </Label>
|
<Label Class="col-sm-3" For="databasetype" HelpText="The database type" ResourceKey="DatabaseType">Type: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
@if (_databases != null)
|
<input id="databasetype" class="form-control" @bind="@_databasetype" readonly />
|
||||||
{
|
|
||||||
<select id="databasetype" class="form-select" @bind="@_databasetype" required>
|
|
||||||
<option value="-"><@Localizer["Type.Select"]></option>
|
|
||||||
@foreach (var database in _databases)
|
|
||||||
{
|
|
||||||
<option value="@database.Name">@Localizer[@database.Name]</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (!string.IsNullOrEmpty(_tenant))
|
|
||||||
{
|
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="tenant" HelpText="The database using this connection" ResourceKey="Tenant">Database: </Label>
|
<Label Class="col-sm-3" For="tenant" HelpText="The database using this connection" ResourceKey="Tenant">Database: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
@ -204,12 +195,12 @@ else
|
||||||
{
|
{
|
||||||
_connectionstring = _connections[_connection].ToString();
|
_connectionstring = _connections[_connection].ToString();
|
||||||
_tenant = "";
|
_tenant = "";
|
||||||
_databasetype = "-";
|
_databasetype = "";
|
||||||
var tenant = _tenants.FirstOrDefault(item => item.DBConnectionString == _connection);
|
var tenant = _tenants.FirstOrDefault(item => item.DBConnectionString == _connection);
|
||||||
if (tenant != null)
|
if (tenant != null)
|
||||||
{
|
{
|
||||||
_tenant = tenant.Name;
|
_tenant = tenant.Name;
|
||||||
_databasetype = _databases.FirstOrDefault(item => item.DBType == tenant.DBType).Name;
|
_databasetype = _databases.FirstOrDefault(item => item.DBType == tenant.DBType && item.Name != "LocalDB").Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
AddModuleMessage(Localizer["Disclaimer.Text"], MessageType.Warning);
|
||||||
|
|
||||||
List<Package> packages = await PackageService.GetPackagesAsync("framework", "", "", "");
|
List<Package> packages = await PackageService.GetPackagesAsync("framework", "", "", "");
|
||||||
if (packages != null)
|
if (packages != null)
|
||||||
{
|
{
|
||||||
|
@ -97,13 +99,16 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
await PackageService.DownloadPackageAsync(packageid, version);
|
await PackageService.DownloadPackageAsync(packageid, version);
|
||||||
await PackageService.DownloadPackageAsync(Constants.UpdaterPackageId, version);
|
await PackageService.DownloadPackageAsync(Constants.UpdaterPackageId, version);
|
||||||
|
HideProgressIndicator();
|
||||||
AddModuleMessage(Localizer["Success.Framework.Download"], MessageType.Success);
|
AddModuleMessage(Localizer["Success.Framework.Download"], MessageType.Success);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Downloading Framework Package {Error}", ex.Message);
|
await logger.LogError(ex, "Error Downloading Framework Package {Error}", ex.Message);
|
||||||
|
HideProgressIndicator();
|
||||||
AddModuleMessage(Localizer["Error.Framework.Download"], MessageType.Error);
|
AddModuleMessage(Localizer["Error.Framework.Download"], MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,13 +182,31 @@ else
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
<Section Name="ExternalLogin" Heading="External Login Settings" ResourceKey="ExternalLoginSettings">
|
<Section Name="ExternalLogin" Heading="External Login Settings" ResourceKey="ExternalLoginSettings">
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="provider" HelpText="Select the external login provider" ResourceKey="Provider">Provider:</Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select id="provider" class="form-select" value="@_provider" @onchange="(e => ProviderChanged(e))">
|
||||||
|
@foreach (var provider in Shared.ExternalLoginProviders.Providers)
|
||||||
|
{
|
||||||
|
<option value="@provider.Name">@Localizer[provider.Name]</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
@if (!string.IsNullOrEmpty(_providerurl))
|
||||||
|
{
|
||||||
|
<a href="@_providerurl" class="btn btn-secondary" target="_new">@Localizer["Info"]</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="providertype" HelpText="Select the external login provider type" ResourceKey="ProviderType">Provider Type:</Label>
|
<Label Class="col-sm-3" For="providertype" HelpText="Select the external login provider type" ResourceKey="ProviderType">Provider Type:</Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select id="providertype" class="form-select" value="@_providertype" @onchange="(e => ProviderTypeChanged(e))">
|
<select id="providertype" class="form-select" value="@_providertype" @onchange="(e => ProviderTypeChanged(e))">
|
||||||
<option value="" selected>@Localizer["Not Specified"]</option>
|
<option value="" selected><@Localizer["Not Specified"]></option>
|
||||||
<option value="@AuthenticationProviderTypes.OpenIDConnect">@Localizer["OpenID Connect"]</option>
|
<option value="@AuthenticationProviderTypes.OpenIDConnect">@Localizer["OIDC"]</option>
|
||||||
<option value="@AuthenticationProviderTypes.OAuth2">@Localizer["OAuth 2.0"]</option>
|
<option value="@AuthenticationProviderTypes.OAuth2">@Localizer["OAuth2"]</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -452,6 +470,8 @@ else
|
||||||
private string _maximumfailures;
|
private string _maximumfailures;
|
||||||
private string _lockoutduration;
|
private string _lockoutduration;
|
||||||
|
|
||||||
|
private string _provider;
|
||||||
|
private string _providerurl;
|
||||||
private string _providertype;
|
private string _providertype;
|
||||||
private string _providername;
|
private string _providername;
|
||||||
private string _authority;
|
private string _authority;
|
||||||
|
@ -519,6 +539,20 @@ else
|
||||||
_maximumfailures = SettingService.GetSetting(settings, "IdentityOptions:Lockout:MaxFailedAccessAttempts", "5");
|
_maximumfailures = SettingService.GetSetting(settings, "IdentityOptions:Lockout:MaxFailedAccessAttempts", "5");
|
||||||
_lockoutduration = TimeSpan.Parse(SettingService.GetSetting(settings, "IdentityOptions:Lockout:DefaultLockoutTimeSpan", "00:05:00")).TotalMinutes.ToString();
|
_lockoutduration = TimeSpan.Parse(SettingService.GetSetting(settings, "IdentityOptions:Lockout:DefaultLockoutTimeSpan", "00:05:00")).TotalMinutes.ToString();
|
||||||
|
|
||||||
|
LoadExternalLoginSettings(settings);
|
||||||
|
|
||||||
|
_secret = SettingService.GetSetting(settings, "JwtOptions:Secret", "");
|
||||||
|
_togglesecret = SharedLocalizer["ShowPassword"];
|
||||||
|
_issuer = SettingService.GetSetting(settings, "JwtOptions:Issuer", PageState.Uri.Scheme + "://" + PageState.Alias.Name);
|
||||||
|
_audience = SettingService.GetSetting(settings, "JwtOptions:Audience", "");
|
||||||
|
_lifetime = SettingService.GetSetting(settings, "JwtOptions:Lifetime", "20");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadExternalLoginSettings(Dictionary<string, string> settings)
|
||||||
|
{
|
||||||
|
_provider = SettingService.GetSetting(settings, "ExternalLogin:Provider", "<Custom>");
|
||||||
|
_providerurl = SettingService.GetSetting(settings, "ExternalLogin:ProviderUrl", "");
|
||||||
_providertype = SettingService.GetSetting(settings, "ExternalLogin:ProviderType", "");
|
_providertype = SettingService.GetSetting(settings, "ExternalLogin:ProviderType", "");
|
||||||
_providername = SettingService.GetSetting(settings, "ExternalLogin:ProviderName", "");
|
_providername = SettingService.GetSetting(settings, "ExternalLogin:ProviderName", "");
|
||||||
_authority = SettingService.GetSetting(settings, "ExternalLogin:Authority", "");
|
_authority = SettingService.GetSetting(settings, "ExternalLogin:Authority", "");
|
||||||
|
@ -546,13 +580,6 @@ else
|
||||||
_domainfilter = SettingService.GetSetting(settings, "ExternalLogin:DomainFilter", "");
|
_domainfilter = SettingService.GetSetting(settings, "ExternalLogin:DomainFilter", "");
|
||||||
_createusers = SettingService.GetSetting(settings, "ExternalLogin:CreateUsers", "true");
|
_createusers = SettingService.GetSetting(settings, "ExternalLogin:CreateUsers", "true");
|
||||||
_verifyusers = SettingService.GetSetting(settings, "ExternalLogin:VerifyUsers", "true");
|
_verifyusers = SettingService.GetSetting(settings, "ExternalLogin:VerifyUsers", "true");
|
||||||
|
|
||||||
_secret = SettingService.GetSetting(settings, "JwtOptions:Secret", "");
|
|
||||||
_togglesecret = SharedLocalizer["ShowPassword"];
|
|
||||||
_issuer = SettingService.GetSetting(settings, "JwtOptions:Issuer", PageState.Uri.Scheme + "://" + PageState.Alias.Name);
|
|
||||||
_audience = SettingService.GetSetting(settings, "JwtOptions:Audience", "");
|
|
||||||
_lifetime = SettingService.GetSetting(settings, "JwtOptions:Lifetime", "20");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadUsersAsync(bool load)
|
private async Task LoadUsersAsync(bool load)
|
||||||
|
@ -617,6 +644,7 @@ else
|
||||||
settings = SettingService.SetSetting(settings, "IdentityOptions:Lockout:MaxFailedAccessAttempts", _maximumfailures, true);
|
settings = SettingService.SetSetting(settings, "IdentityOptions:Lockout:MaxFailedAccessAttempts", _maximumfailures, true);
|
||||||
settings = SettingService.SetSetting(settings, "IdentityOptions:Lockout:DefaultLockoutTimeSpan", TimeSpan.FromMinutes(Convert.ToInt64(_lockoutduration)).ToString(), true);
|
settings = SettingService.SetSetting(settings, "IdentityOptions:Lockout:DefaultLockoutTimeSpan", TimeSpan.FromMinutes(Convert.ToInt64(_lockoutduration)).ToString(), true);
|
||||||
|
|
||||||
|
settings = SettingService.SetSetting(settings, "ExternalLogin:Provider", _provider, false);
|
||||||
settings = SettingService.SetSetting(settings, "ExternalLogin:ProviderType", _providertype, false);
|
settings = SettingService.SetSetting(settings, "ExternalLogin:ProviderType", _providertype, false);
|
||||||
settings = SettingService.SetSetting(settings, "ExternalLogin:ProviderName", _providername, false);
|
settings = SettingService.SetSetting(settings, "ExternalLogin:ProviderName", _providername, false);
|
||||||
settings = SettingService.SetSetting(settings, "ExternalLogin:Authority", _authority, true);
|
settings = SettingService.SetSetting(settings, "ExternalLogin:Authority", _authority, true);
|
||||||
|
@ -665,6 +693,17 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ProviderChanged(ChangeEventArgs e)
|
||||||
|
{
|
||||||
|
_provider = (string)e.Value;
|
||||||
|
var provider = Shared.ExternalLoginProviders.Providers.FirstOrDefault(item => item.Name == _provider);
|
||||||
|
if (provider != null)
|
||||||
|
{
|
||||||
|
LoadExternalLoginSettings(provider.Settings);
|
||||||
|
}
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private void ProviderTypeChanged(ChangeEventArgs e)
|
private void ProviderTypeChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_providertype = (string)e.Value;
|
_providertype = (string)e.Value;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
{
|
{
|
||||||
<NavLink class="ms-2" href="@NavigateUrl("admin/log")">View Details</NavLink>
|
<NavLink class="ms-2" href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||||
}
|
}
|
||||||
|
@if (ModuleState != null)
|
||||||
|
{
|
||||||
@if (ModuleState.RenderMode == RenderModes.Static)
|
@if (ModuleState.RenderMode == RenderModes.Static)
|
||||||
{
|
{
|
||||||
<a href="@NavigationManager.Uri" class="btn-close" data-dismiss="alert" aria-label="close"></a>
|
<a href="@NavigationManager.Uri" class="btn-close" data-dismiss="alert" aria-label="close"></a>
|
||||||
|
@ -18,6 +20,7 @@
|
||||||
{
|
{
|
||||||
<button type="button" class="btn-close" data-dismiss="alert" aria-label="close" @onclick="CloseMessage"></button>
|
<button type="button" class="btn-close" data-dismiss="alert" aria-label="close" @onclick="CloseMessage"></button>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,9 +452,9 @@
|
||||||
_displayPages = int.Parse(DisplayPages);
|
_displayPages = int.Parse(DisplayPages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PageState.QueryString.ContainsKey("page"))
|
if (PageState.QueryString.ContainsKey("page") && int.TryParse(PageState.QueryString["page"], out int page))
|
||||||
{
|
{
|
||||||
_page = int.Parse(PageState.QueryString["page"]);
|
_page = page;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
|
@ -22,10 +22,10 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
<value>Enter the site name</value>
|
<value>Enter the site name</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Tenant.HelpText" xml:space="preserve">
|
<data name="Tenant.HelpText" xml:space="preserve">
|
||||||
<value>The name of the database used for the site</value>
|
<value>The name of the database used for the site. Note that this is not the physical database name but rather the tenant name which is used within the framework to identify a database.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Aliases.HelpText" xml:space="preserve">
|
<data name="Aliases.HelpText" xml:space="preserve">
|
||||||
<value>The urls for the site. This can include domain names (ie. domain.com), subdomains (ie. sub.domain.com) or virtual folders (ie. domain.com/folder).</value>
|
<value>The urls for the site. This can include domain names (ie. domain.com), subdomains (ie. sub.domain.com) or virtual folders (ie. domain.com/folder).</value>
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
<value>Type:</value>
|
<value>Type:</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ConnectionString.HelpText" xml:space="preserve">
|
<data name="ConnectionString.HelpText" xml:space="preserve">
|
||||||
<value>The connection information for the database</value>
|
<value>The name of the connection string in appsettings.json which will be used to connect to the database</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Database.HelpText" xml:space="preserve">
|
<data name="Database.HelpText" xml:space="preserve">
|
||||||
<value>The type of database</value>
|
<value>The type of database</value>
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
<value>Select the database for the site</value>
|
<value>Select the database for the site</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TenantName.HelpText" xml:space="preserve">
|
<data name="TenantName.HelpText" xml:space="preserve">
|
||||||
<value>Enter the name for the database</value>
|
<value>Enter the name for the database. Note that this will be the tenant name which is used within the framework to identify the database.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="DatabaseType.HelpText" xml:space="preserve">
|
<data name="DatabaseType.HelpText" xml:space="preserve">
|
||||||
<value>Select the database type</value>
|
<value>Select the database type</value>
|
||||||
|
|
|
@ -150,4 +150,7 @@
|
||||||
<data name="Localhost.Text" xml:space="preserve">
|
<data name="Localhost.Text" xml:space="preserve">
|
||||||
<value>You Cannot Perform A System Update In A Development Environment</value>
|
<value>You Cannot Perform A System Update In A Development Environment</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Disclaimer.Text" xml:space="preserve">
|
||||||
|
<value>Please Note That The System Update Capability Is A Simplified Upgrade Process Intended For Small To Medium Sized Installations. For Larger Enterprise Installations You Will Want To Use A Manual Upgrade Process. Also Note That The System Update Capability Is Not Recommended When Using Microsoft Azure Due To The Limitations Of That Environment. </value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -480,4 +480,19 @@
|
||||||
<data name="NameClaimType.Text" xml:space="preserve">
|
<data name="NameClaimType.Text" xml:space="preserve">
|
||||||
<value>Name Claim:</value>
|
<value>Name Claim:</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Provider.HelpText" xml:space="preserve">
|
||||||
|
<value>Select the external login provider</value>
|
||||||
|
</data>
|
||||||
|
<data name="Provider.Text" xml:space="preserve">
|
||||||
|
<value>Provider:</value>
|
||||||
|
</data>
|
||||||
|
<data name="Info" xml:space="preserve">
|
||||||
|
<value>Info</value>
|
||||||
|
</data>
|
||||||
|
<data name="OAuth2" xml:space="preserve">
|
||||||
|
<value>OAuth 2.0</value>
|
||||||
|
</data>
|
||||||
|
<data name="OIDC" xml:space="preserve">
|
||||||
|
<value>OpenID Connect (OIDC)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -22,7 +22,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a class="dropdown-item @(CultureInfo.CurrentUICulture.Name == culture.Name ? "active" : String.Empty)" href="@NavigateUrl(PageState.Page.Path, "culture=" + culture.Name)">@culture.DisplayName</a>
|
<a class="dropdown-item @(CultureInfo.CurrentUICulture.Name == culture.Name ? "active" : String.Empty)" href="@NavigateUrl(PageState.Page.Path, "culture=" + culture.Name)" data-enhance-nav="false">@culture.DisplayName</a>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,8 +45,7 @@
|
||||||
{
|
{
|
||||||
MenuAlignment = DropdownAlignment.ToLower() == "right" ? "dropdown-menu-end" : string.Empty;
|
MenuAlignment = DropdownAlignment.ToLower() == "right" ? "dropdown-menu-end" : string.Empty;
|
||||||
|
|
||||||
var languages = PageState.Languages;
|
_supportedCultures = PageState.Languages.Select(l => new Culture { Name = l.Code, DisplayName = l.Name });
|
||||||
_supportedCultures = languages.Select(l => new Culture { Name = l.Code, DisplayName = l.Name });
|
|
||||||
|
|
||||||
if (PageState.QueryString.ContainsKey("culture"))
|
if (PageState.QueryString.ContainsKey("culture"))
|
||||||
{
|
{
|
||||||
|
@ -54,9 +53,18 @@
|
||||||
if (_supportedCultures.Any(item => item.Name == culture))
|
if (_supportedCultures.Any(item => item.Name == culture))
|
||||||
{
|
{
|
||||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||||
HttpContext.Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, new CookieOptions { Path = "/", Expires = DateTimeOffset.UtcNow.AddYears(365) });
|
|
||||||
|
HttpContext.Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, new CookieOptions
|
||||||
|
{
|
||||||
|
Path = "/",
|
||||||
|
Expires = DateTimeOffset.UtcNow.AddYears(365),
|
||||||
|
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax, // Set SameSite attribute
|
||||||
|
Secure = true, // Ensure the cookie is only sent over HTTPS
|
||||||
|
HttpOnly = false // cookie is updated using JS Interop in Interactive render mode
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
NavigationManager.NavigateTo(NavigationManager.Uri.Replace($"?culture={culture}", ""), forceLoad: true);
|
NavigationManager.NavigateTo(NavigationManager.Uri.Replace($"?culture={culture}", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +74,8 @@
|
||||||
{
|
{
|
||||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||||
var interop = new Interop(JSRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
|
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360, true, "Lax");
|
||||||
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
|
NavigationManager.NavigateTo(NavigationManager.Uri, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,18 @@ namespace Oqtane.UI
|
||||||
_jsRuntime = jsRuntime;
|
_jsRuntime = jsRuntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SetCookie(string name, string value, int days)
|
public async Task SetCookie(string name, string value, int days)
|
||||||
|
{
|
||||||
|
await SetCookie(name, value, days, true, "Lax");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task SetCookie(string name, string value, int days, bool secure, string sameSite)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeVoidAsync(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"Oqtane.Interop.setCookie",
|
"Oqtane.Interop.setCookie",
|
||||||
name, value, days);
|
name, value, days, secure, sameSite);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MySql.EntityFrameworkCore" Version="8.0.5" />
|
<PackageReference Include="MySql.EntityFrameworkCore" Version="8.0.5" />
|
||||||
<PackageReference Include="MySql.Data" Version="9.0.0" />
|
<PackageReference Include="MySql.Data" Version="9.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EFCore.NamingConventions" Version="8.0.3" />
|
<PackageReference Include="EFCore.NamingConventions" Version="8.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<!-- <TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> -->
|
<!-- <TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> -->
|
||||||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<RootNamespace>Oqtane.Maui</RootNamespace>
|
<RootNamespace>Oqtane.Maui</RootNamespace>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<ApplicationIdGuid>0E29FC31-1B83-48ED-B6E0-9F3C67B775D4</ApplicationIdGuid>
|
<ApplicationIdGuid>0E29FC31-1B83-48ED-B6E0-9F3C67B775D4</ApplicationIdGuid>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>5.2.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>5.2.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||||
|
@ -65,15 +65,15 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
|
<PackageReference Include="System.Net.Http.Json" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.80" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.91" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.80" />
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.91" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.80" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.91" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
var Oqtane = Oqtane || {};
|
var Oqtane = Oqtane || {};
|
||||||
|
|
||||||
Oqtane.Interop = {
|
Oqtane.Interop = {
|
||||||
setCookie: function (name, value, days) {
|
setCookie: function (name, value, days, secure, sameSite) {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||||
var expires = "expires=" + d.toUTCString();
|
var expires = "expires=" + d.toUTCString();
|
||||||
document.cookie = name + "=" + value + ";" + expires + ";path=/";
|
var cookieString = name + "=" + value + ";" + expires + ";path=/";
|
||||||
|
if (secure) {
|
||||||
|
cookieString += "; secure";
|
||||||
|
}
|
||||||
|
if (sameSite === "Lax" || sameSite === "Strict" || sameSite === "None") {
|
||||||
|
cookieString += "; SameSite=" + sameSite;
|
||||||
|
}
|
||||||
|
document.cookie = cookieString;
|
||||||
},
|
},
|
||||||
getCookie: function (name) {
|
getCookie: function (name) {
|
||||||
name = name + "=";
|
name = name + "=";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Client</id>
|
<id>Oqtane.Client</id>
|
||||||
<version>5.2.3</version>
|
<version>5.2.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</releaseNotes>
|
||||||
<readme>readme.md</readme>
|
<readme>readme.md</readme>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Framework</id>
|
<id>Oqtane.Framework</id>
|
||||||
<version>5.2.3</version>
|
<version>5.2.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
|
@ -11,8 +11,8 @@
|
||||||
<copyright>.NET Foundation</copyright>
|
<copyright>.NET Foundation</copyright>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework/releases/download/v5.2.3/Oqtane.Framework.5.2.3.Upgrade.zip</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework/releases/download/v5.2.4/Oqtane.Framework.5.2.4.Upgrade.zip</projectUrl>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</releaseNotes>
|
||||||
<readme>readme.md</readme>
|
<readme>readme.md</readme>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane framework</tags>
|
<tags>oqtane framework</tags>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Server</id>
|
<id>Oqtane.Server</id>
|
||||||
<version>5.2.3</version>
|
<version>5.2.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</releaseNotes>
|
||||||
<readme>readme.md</readme>
|
<readme>readme.md</readme>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Shared</id>
|
<id>Oqtane.Shared</id>
|
||||||
<version>5.2.3</version>
|
<version>5.2.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</releaseNotes>
|
||||||
<readme>readme.md</readme>
|
<readme>readme.md</readme>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Updater</id>
|
<id>Oqtane.Updater</id>
|
||||||
<version>5.2.3</version>
|
<version>5.2.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</releaseNotes>
|
||||||
<readme>readme.md</readme>
|
<readme>readme.md</readme>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Compress-Archive -Path "..\Oqtane.Server\bin\Release\net8.0\publish\*" -DestinationPath "Oqtane.Framework.5.2.3.Install.zip" -Force
|
Compress-Archive -Path "..\Oqtane.Server\bin\Release\net8.0\publish\*" -DestinationPath "Oqtane.Framework.5.2.4.Install.zip" -Force
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Compress-Archive -Path "..\Oqtane.Server\bin\Release\net8.0\publish\*" -DestinationPath "Oqtane.Framework.5.2.3.Upgrade.zip" -Force
|
Compress-Archive -Path "..\Oqtane.Server\bin\Release\net8.0\publish\*" -DestinationPath "Oqtane.Framework.5.2.4.Upgrade.zip" -Force
|
||||||
|
|
|
@ -522,7 +522,7 @@
|
||||||
" let currentUrl = window.location.pathname;" + Environment.NewLine +
|
" let currentUrl = window.location.pathname;" + Environment.NewLine +
|
||||||
" Blazor.addEventListener('enhancedload', () => {" + Environment.NewLine +
|
" Blazor.addEventListener('enhancedload', () => {" + Environment.NewLine +
|
||||||
" let newUrl = window.location.pathname;" + Environment.NewLine +
|
" let newUrl = window.location.pathname;" + Environment.NewLine +
|
||||||
" if (currentUrl !== newUrl || window.location.hash === '') {" + Environment.NewLine +
|
" if (currentUrl !== newUrl || window.location.hash === '#top') {" + Environment.NewLine +
|
||||||
" window.scrollTo({ top: 0, left: 0, behavior: 'instant' });" + Environment.NewLine +
|
" window.scrollTo({ top: 0, left: 0, behavior: 'instant' });" + Environment.NewLine +
|
||||||
" }" + Environment.NewLine +
|
" }" + Environment.NewLine +
|
||||||
" currentUrl = newUrl;" + Environment.NewLine +
|
" currentUrl = newUrl;" + Environment.NewLine +
|
||||||
|
@ -609,7 +609,7 @@
|
||||||
Expires = DateTimeOffset.UtcNow.AddYears(1),
|
Expires = DateTimeOffset.UtcNow.AddYears(1),
|
||||||
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax, // Set SameSite attribute
|
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax, // Set SameSite attribute
|
||||||
Secure = true, // Ensure the cookie is only sent over HTTPS
|
Secure = true, // Ensure the cookie is only sent over HTTPS
|
||||||
HttpOnly = true // Optional: Helps mitigate XSS attacks
|
HttpOnly = false // cookie is updated using JS Interop in Interactive render mode
|
||||||
};
|
};
|
||||||
|
|
||||||
Context.Response.Cookies.Append(
|
Context.Response.Cookies.Append(
|
||||||
|
|
|
@ -17,11 +17,10 @@ using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Extensions;
|
using Oqtane.Extensions;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Processing;
|
|
||||||
using SixLabors.ImageSharp.Formats.Png;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using Oqtane.Services;
|
||||||
|
|
||||||
// ReSharper disable StringIndexOfIsCultureSpecific.1
|
// ReSharper disable StringIndexOfIsCultureSpecific.1
|
||||||
|
|
||||||
|
@ -38,7 +37,9 @@ namespace Oqtane.Controllers
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
private readonly Alias _alias;
|
private readonly Alias _alias;
|
||||||
private readonly ISettingRepository _settingRepository;
|
private readonly ISettingRepository _settingRepository;
|
||||||
public FileController(IWebHostEnvironment environment, IFileRepository files, IFolderRepository folders, IUserPermissions userPermissions, ISettingRepository settingRepository, ISyncManager syncManager, ILogManager logger, ITenantManager tenantManager)
|
private readonly IImageService _imageService;
|
||||||
|
|
||||||
|
public FileController(IWebHostEnvironment environment, IFileRepository files, IFolderRepository folders, IUserPermissions userPermissions, ISettingRepository settingRepository, ISyncManager syncManager, ILogManager logger, ITenantManager tenantManager, IImageService imageService)
|
||||||
{
|
{
|
||||||
_environment = environment;
|
_environment = environment;
|
||||||
_files = files;
|
_files = files;
|
||||||
|
@ -48,6 +49,7 @@ namespace Oqtane.Controllers
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_alias = tenantManager.GetAlias();
|
_alias = tenantManager.GetAlias();
|
||||||
_settingRepository = settingRepository;
|
_settingRepository = settingRepository;
|
||||||
|
_imageService = imageService;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/<controller>?folder=x
|
// GET: api/<controller>?folder=x
|
||||||
|
@ -681,22 +683,18 @@ namespace Oqtane.Controllers
|
||||||
var filepath = _files.GetFilePath(file);
|
var filepath = _files.GetFilePath(file);
|
||||||
if (System.IO.File.Exists(filepath))
|
if (System.IO.File.Exists(filepath))
|
||||||
{
|
{
|
||||||
// validation
|
|
||||||
if (!Enum.TryParse(mode, true, out ResizeMode _)) mode = "crop";
|
|
||||||
if (!Enum.TryParse(position, true, out AnchorPositionMode _)) position = "center";
|
|
||||||
if (!Color.TryParseHex("#" + background, out _)) background = "transparent";
|
|
||||||
if (!int.TryParse(rotate, out _)) rotate = "0";
|
|
||||||
rotate = (int.Parse(rotate) < 0 || int.Parse(rotate) > 360) ? "0" : rotate;
|
|
||||||
if (!bool.TryParse(recreate, out _)) recreate = "false";
|
if (!bool.TryParse(recreate, out _)) recreate = "false";
|
||||||
|
|
||||||
string imagepath = filepath.Replace(Path.GetExtension(filepath), "." + width.ToString() + "x" + height.ToString() + ".png");
|
string format = "png";
|
||||||
|
|
||||||
|
string imagepath = filepath.Replace(Path.GetExtension(filepath), "." + width.ToString() + "x" + height.ToString() + "." + format);
|
||||||
if (!System.IO.File.Exists(imagepath) || bool.Parse(recreate))
|
if (!System.IO.File.Exists(imagepath) || bool.Parse(recreate))
|
||||||
{
|
{
|
||||||
// user has edit access to folder or folder supports the image size being created
|
// user has edit access to folder or folder supports the image size being created
|
||||||
if (_userPermissions.IsAuthorized(User, PermissionNames.Edit, file.Folder.PermissionList) ||
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Edit, file.Folder.PermissionList) ||
|
||||||
(!string.IsNullOrEmpty(file.Folder.ImageSizes) && (file.Folder.ImageSizes == "*" || file.Folder.ImageSizes.ToLower().Split(",").Contains(width.ToString() + "x" + height.ToString()))))
|
(!string.IsNullOrEmpty(file.Folder.ImageSizes) && (file.Folder.ImageSizes == "*" || file.Folder.ImageSizes.ToLower().Split(",").Contains(width.ToString() + "x" + height.ToString()))))
|
||||||
{
|
{
|
||||||
imagepath = CreateImage(filepath, width, height, mode, position, background, rotate, imagepath);
|
imagepath = _imageService.CreateImage(filepath, width, height, mode, position, background, rotate, format, imagepath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -743,70 +741,6 @@ namespace Oqtane.Controllers
|
||||||
return System.IO.File.Exists(errorPath) ? PhysicalFile(errorPath, MimeUtilities.GetMimeType(errorPath)) : null;
|
return System.IO.File.Exists(errorPath) ? PhysicalFile(errorPath, MimeUtilities.GetMimeType(errorPath)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string CreateImage(string filepath, int width, int height, string mode, string position, string background, string rotate, string imagepath)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var stream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
stream.Position = 0;
|
|
||||||
using (var image = Image.Load(stream))
|
|
||||||
{
|
|
||||||
int.TryParse(rotate, out int angle);
|
|
||||||
Enum.TryParse(mode, true, out ResizeMode resizemode);
|
|
||||||
Enum.TryParse(position, true, out AnchorPositionMode anchorpositionmode);
|
|
||||||
|
|
||||||
PngEncoder encoder;
|
|
||||||
|
|
||||||
if (background != "transparent")
|
|
||||||
{
|
|
||||||
image.Mutate(x => x
|
|
||||||
.AutoOrient() // auto orient the image
|
|
||||||
.Rotate(angle)
|
|
||||||
.Resize(new ResizeOptions
|
|
||||||
{
|
|
||||||
Mode = resizemode,
|
|
||||||
Position = anchorpositionmode,
|
|
||||||
Size = new Size(width, height),
|
|
||||||
PadColor = Color.ParseHex("#" + background)
|
|
||||||
}));
|
|
||||||
|
|
||||||
encoder = new PngEncoder();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
image.Mutate(x => x
|
|
||||||
.AutoOrient() // auto orient the image
|
|
||||||
.Rotate(angle)
|
|
||||||
.Resize(new ResizeOptions
|
|
||||||
{
|
|
||||||
Mode = resizemode,
|
|
||||||
Position = anchorpositionmode,
|
|
||||||
Size = new Size(width, height)
|
|
||||||
}));
|
|
||||||
|
|
||||||
encoder = new PngEncoder
|
|
||||||
{
|
|
||||||
ColorType = PngColorType.RgbWithAlpha,
|
|
||||||
TransparentColorMode = PngTransparentColorMode.Preserve,
|
|
||||||
BitDepth = PngBitDepth.Bit8,
|
|
||||||
CompressionLevel = PngCompressionLevel.BestSpeed
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
image.Save(imagepath, encoder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, ex, "Error Creating Image For File {FilePath} {Width} {Height} {Mode} {Rotate} {Error}", filepath, width, height, mode, rotate, ex.Message);
|
|
||||||
imagepath = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return imagepath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetFolderPath(string folder)
|
private string GetFolderPath(string folder)
|
||||||
{
|
{
|
||||||
return Utilities.PathCombine(_environment.ContentRootPath, folder);
|
return Utilities.PathCombine(_environment.ContentRootPath, folder);
|
||||||
|
|
|
@ -55,6 +55,10 @@ namespace Oqtane.Controllers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
languages = _languages.GetLanguages(SiteId).ToList();
|
languages = _languages.GetLanguages(SiteId).ToList();
|
||||||
|
foreach (Language language in languages)
|
||||||
|
{
|
||||||
|
language.Name = CultureInfo.GetCultureInfo(language.Code).DisplayName;
|
||||||
|
}
|
||||||
if (!string.IsNullOrEmpty(packagename))
|
if (!string.IsNullOrEmpty(packagename))
|
||||||
{
|
{
|
||||||
foreach (var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"{packagename}*{Constants.SatelliteAssemblyExtension}", SearchOption.AllDirectories))
|
foreach (var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"{packagename}*{Constants.SatelliteAssemblyExtension}", SearchOption.AllDirectories))
|
||||||
|
@ -85,6 +89,7 @@ namespace Oqtane.Controllers
|
||||||
var language = _languages.GetLanguage(id);
|
var language = _languages.GetLanguage(id);
|
||||||
if (language != null && language.SiteId == _alias.SiteId)
|
if (language != null && language.SiteId == _alias.SiteId)
|
||||||
{
|
{
|
||||||
|
language.Name = CultureInfo.GetCultureInfo(language.Code).DisplayName;
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,10 +8,6 @@ using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using Microsoft.Extensions.Localization;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,7 +189,7 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(string entityName, int entityId, string settingName)
|
public void Delete(string entityName, int entityId, string settingName)
|
||||||
{
|
{
|
||||||
Setting setting = _settings.GetSetting(entityName, entityId, settingName);
|
Setting setting = _settings.GetSetting(entityName, entityId, settingName);
|
||||||
if (IsAuthorized(setting.EntityName, setting.EntityId, PermissionNames.Edit))
|
if (setting != null && IsAuthorized(setting.EntityName, setting.EntityId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_settings.DeleteSetting(setting.EntityName, setting.SettingId);
|
_settings.DeleteSetting(setting.EntityName, setting.SettingId);
|
||||||
AddSyncEvent(setting.EntityName, setting.EntityId, setting.SettingId, SyncEventActions.Delete);
|
AddSyncEvent(setting.EntityName, setting.EntityId, setting.SettingId, SyncEventActions.Delete);
|
||||||
|
@ -199,7 +199,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
if (entityName != EntityNames.Visitor)
|
if (entityName != EntityNames.Visitor)
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Delete, "User Not Authorized To Delete Setting {Setting}", setting);
|
_logger.Log(LogLevel.Error, this, LogFunction.Delete, "Setting Does Not Exist Or User Not Authorized To Delete Setting For Entity {EntityName} Id {EntityId} Name {SettingName}", entityName, entityId, settingName);
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using Oqtane.Databases.Interfaces;
|
using Oqtane.Databases.Interfaces;
|
||||||
using Oqtane.Interfaces;
|
|
||||||
|
|
||||||
namespace Oqtane.Repository.Databases.Interfaces
|
namespace Oqtane.Repository.Databases.Interfaces
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,6 +102,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
services.AddScoped<ISearchResultsService, SearchResultsService>();
|
services.AddScoped<ISearchResultsService, SearchResultsService>();
|
||||||
services.AddScoped<ISearchService, SearchService>();
|
services.AddScoped<ISearchService, SearchService>();
|
||||||
services.AddScoped<ISearchProvider, DatabaseSearchProvider>();
|
services.AddScoped<ISearchProvider, DatabaseSearchProvider>();
|
||||||
|
services.AddScoped<IImageService, ImageService>();
|
||||||
|
|
||||||
// providers
|
// providers
|
||||||
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.QuillJSTextEditor>();
|
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.QuillJSTextEditor>();
|
||||||
|
@ -169,6 +170,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
options.Cookie.HttpOnly = true;
|
options.Cookie.HttpOnly = true;
|
||||||
options.Cookie.SameSite = SameSiteMode.Lax;
|
options.Cookie.SameSite = SameSiteMode.Lax;
|
||||||
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
|
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
|
||||||
|
options.LoginPath = "/login"; // overrides .NET Identity default of /Account/Login
|
||||||
options.Events.OnRedirectToLogin = context =>
|
options.Events.OnRedirectToLogin = context =>
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
|
|
|
@ -592,7 +592,7 @@ namespace Oqtane.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// create claims identity
|
// create claims identity
|
||||||
identityuser = await _identityUserManager.FindByEmailAsync(user.Username);
|
identityuser = await _identityUserManager.FindByNameAsync(user.Username);
|
||||||
user.SecurityStamp = identityuser.SecurityStamp;
|
user.SecurityStamp = identityuser.SecurityStamp;
|
||||||
identity = UserSecurity.CreateClaimsIdentity(alias, user, userRoles);
|
identity = UserSecurity.CreateClaimsIdentity(alias, user, userRoles);
|
||||||
identity.Label = ExternalLoginStatus.Success;
|
identity.Label = ExternalLoginStatus.Success;
|
||||||
|
@ -645,13 +645,13 @@ namespace Oqtane.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Log(LogLevel.Information, "ExternalLogin", Enums.LogFunction.Security, "External User Login Successful For {Username} From IP Address {IPAddress} Using Provider {Provider}", user.Username, httpContext.Connection.RemoteIpAddress, providerName);
|
_logger.Log(LogLevel.Information, "ExternalLogin", Enums.LogFunction.Security, "External User Login Successful For {Username} From IP Address {IPAddress} Using Provider {Provider}", user.Username, httpContext.Connection.RemoteIpAddress.ToString(), providerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // claims invalid
|
else // claims invalid
|
||||||
{
|
{
|
||||||
identity.Label = ExternalLoginStatus.MissingClaims;
|
identity.Label = ExternalLoginStatus.MissingClaims;
|
||||||
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "Provider Did Not Return All Of The Claims Types Specified Or Email Address Does Not Saitisfy Domain Filter. The Actual Claims Returned Were {Claims}. Login Was Denied.", claims);
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "Provider Did Not Return All Of The Claims Types Specified Or Email Address Does Not Satisfy Domain Filter. The Actual Claims Returned Were {Claims}. Login Was Denied.", claims);
|
||||||
}
|
}
|
||||||
|
|
||||||
return identity;
|
return identity;
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace Oqtane.Infrastructure
|
||||||
// add new site
|
// add new site
|
||||||
if (install.TenantName != TenantNames.Master && install.ConnectionString.Contains("="))
|
if (install.TenantName != TenantNames.Master && install.ConnectionString.Contains("="))
|
||||||
{
|
{
|
||||||
_configManager.AddOrUpdateSetting($"{SettingKeys.ConnectionStringsSection}:{install.TenantName}", install.ConnectionString, false);
|
_configManager.AddOrUpdateSetting($"{SettingKeys.ConnectionStringsSection}:{install.TenantName}", install.ConnectionString, true);
|
||||||
}
|
}
|
||||||
if (install.TenantName == TenantNames.Master && !install.ConnectionString.Contains("="))
|
if (install.TenantName == TenantNames.Master && !install.ConnectionString.Contains("="))
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,6 @@ namespace Oqtane.Infrastructure
|
||||||
AddEFMigrationsHistory(sql, _configManager.GetSetting($"{SettingKeys.ConnectionStringsSection}:{tenant.DBConnectionString}", ""), tenant.DBType, tenant.Version, false);
|
AddEFMigrationsHistory(sql, _configManager.GetSetting($"{SettingKeys.ConnectionStringsSection}:{tenant.DBConnectionString}", ""), tenant.DBType, tenant.Version, false);
|
||||||
// push latest model into database
|
// push latest model into database
|
||||||
tenantDbContext.Database.Migrate();
|
tenantDbContext.Database.Migrate();
|
||||||
result.Success = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -384,6 +383,8 @@ namespace Oqtane.Infrastructure
|
||||||
_filelogger.LogError(Utilities.LogMessage(this, result.Message));
|
_filelogger.LogError(Utilities.LogMessage(this, result.Message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(result.Message))
|
||||||
|
{
|
||||||
// execute any version specific upgrade logic
|
// execute any version specific upgrade logic
|
||||||
var version = tenant.Version;
|
var version = tenant.Version;
|
||||||
var index = Array.FindIndex(versions, item => item == version);
|
var index = Array.FindIndex(versions, item => item == version);
|
||||||
|
@ -408,12 +409,10 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(result.Message))
|
|
||||||
{
|
|
||||||
result.Success = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.Success = string.IsNullOrEmpty(result.Message);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +587,7 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
// add host role
|
// add host role
|
||||||
var hostRoleId = roles.GetRoles(user.SiteId, true).FirstOrDefault(item => item.Name == RoleNames.Host)?.RoleId ?? 0;
|
var hostRoleId = roles.GetRoles(user.SiteId, true).FirstOrDefault(item => item.Name == RoleNames.Host)?.RoleId ?? 0;
|
||||||
var userRole = new UserRole { UserId = user.UserId, RoleId = hostRoleId, EffectiveDate = null, ExpiryDate = null };
|
var userRole = new UserRole { UserId = user.UserId, RoleId = hostRoleId, EffectiveDate = null, ExpiryDate = null, IgnoreSecurityStamp = true };
|
||||||
userRoles.AddUserRole(userRole);
|
userRoles.AddUserRole(userRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,9 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate recipient
|
// validate recipient
|
||||||
if (string.IsNullOrEmpty(notification.ToEmail))
|
if (string.IsNullOrEmpty(notification.ToEmail) || !MailAddress.TryCreate(notification.ToEmail, out _))
|
||||||
{
|
{
|
||||||
log += "Recipient Missing For NotificationId: " + notification.NotificationId + "<br />";
|
log += $"NotificationId: {notification.NotificationId} - Has Missing Or Invalid Recipient {notification.ToEmail}<br />";
|
||||||
notification.IsDeleted = true;
|
notification.IsDeleted = true;
|
||||||
notificationRepository.UpdateNotification(notification);
|
notificationRepository.UpdateNotification(notification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,19 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
schema: Schema);
|
schema: Schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void AddForeignKey(string foreignKeyName, string columnName, string principalTable, string principalColumn, string principalSchema, ReferentialAction onDelete)
|
||||||
|
{
|
||||||
|
_migrationBuilder.AddForeignKey(
|
||||||
|
name: RewriteName(foreignKeyName),
|
||||||
|
table: RewriteName(EntityTableName),
|
||||||
|
column: RewriteName(columnName),
|
||||||
|
principalTable: RewriteName(principalTable),
|
||||||
|
principalColumn: RewriteName(principalColumn),
|
||||||
|
principalSchema: RewriteName(principalSchema),
|
||||||
|
onDelete: onDelete,
|
||||||
|
schema: Schema);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a Migration to add an Index to the Entity (table)
|
/// Creates a Migration to add an Index to the Entity (table)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -368,6 +381,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
column: foreignKey.Column,
|
column: foreignKey.Column,
|
||||||
principalTable: RewriteName(foreignKey.PrincipalTable),
|
principalTable: RewriteName(foreignKey.PrincipalTable),
|
||||||
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
||||||
|
principalSchema: RewriteName(foreignKey.PrincipalSchema),
|
||||||
onDelete: foreignKey.OnDeleteAction);
|
onDelete: foreignKey.OnDeleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +395,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
column: RewriteName(foreignKey.ColumnName),
|
column: RewriteName(foreignKey.ColumnName),
|
||||||
principalTable: RewriteName(foreignKey.PrincipalTable),
|
principalTable: RewriteName(foreignKey.PrincipalTable),
|
||||||
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
principalColumn: RewriteName(foreignKey.PrincipalColumn),
|
||||||
|
principalSchema: RewriteName(foreignKey.PrincipalSchema),
|
||||||
onDelete: foreignKey.OnDeleteAction,
|
onDelete: foreignKey.OnDeleteAction,
|
||||||
schema: Schema);
|
schema: Schema);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,16 @@ namespace Oqtane.Migrations
|
||||||
OnDeleteAction = onDeleteAction;
|
OnDeleteAction = onDeleteAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForeignKey(string name, Expression<Func<TEntityBuilder, object>> column, string principalTable, string principalColumn, string principalSchema, ReferentialAction onDeleteAction)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Column = column;
|
||||||
|
PrincipalTable = principalTable;
|
||||||
|
PrincipalColumn = principalColumn;
|
||||||
|
PrincipalSchema = principalSchema;
|
||||||
|
OnDeleteAction = onDeleteAction;
|
||||||
|
}
|
||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
public Expression<Func<TEntityBuilder, object>> Column { get;}
|
public Expression<Func<TEntityBuilder, object>> Column { get;}
|
||||||
|
@ -34,6 +44,8 @@ namespace Oqtane.Migrations
|
||||||
|
|
||||||
public string PrincipalColumn { get; }
|
public string PrincipalColumn { get; }
|
||||||
|
|
||||||
|
public string PrincipalSchema { get; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Oqtane.Databases.Interfaces;
|
||||||
|
using Oqtane.Migrations.EntityBuilders;
|
||||||
|
using Oqtane.Repository;
|
||||||
|
|
||||||
|
namespace Oqtane.Migrations.Tenant
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TenantDBContext))]
|
||||||
|
[Migration("Tenant.05.02.04.01")]
|
||||||
|
public class RemoveLanguageName : MultiDatabaseMigration
|
||||||
|
{
|
||||||
|
public RemoveLanguageName(IDatabase database) : base(database)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
var languageEntityBuilder = new LanguageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
languageEntityBuilder.DropColumn("Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
// not implemented
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
|
@ -33,21 +33,21 @@
|
||||||
<EmbeddedResource Include="Scripts\MigrateTenant.sql" />
|
<EmbeddedResource Include="Scripts\MigrateTenant.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.62" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.67" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.10" />
|
||||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.9" />
|
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />
|
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
@ -14,6 +15,7 @@ using Oqtane.Infrastructure;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Pages
|
namespace Oqtane.Pages
|
||||||
|
@ -28,8 +30,10 @@ namespace Oqtane.Pages
|
||||||
private readonly ISyncManager _syncManager;
|
private readonly ISyncManager _syncManager;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
private readonly Alias _alias;
|
private readonly Alias _alias;
|
||||||
|
private readonly IImageService _imageService;
|
||||||
|
private readonly ISettingRepository _settingRepository;
|
||||||
|
|
||||||
public FilesModel(IWebHostEnvironment environment, IFileRepository files, IUserPermissions userPermissions, IUrlMappingRepository urlMappings, ISyncManager syncManager, ILogManager logger, ITenantManager tenantManager)
|
public FilesModel(IWebHostEnvironment environment, IFileRepository files, IUserPermissions userPermissions, IUrlMappingRepository urlMappings, ISyncManager syncManager, ILogManager logger, ITenantManager tenantManager, IImageService imageService, ISettingRepository settingRepository)
|
||||||
{
|
{
|
||||||
_environment = environment;
|
_environment = environment;
|
||||||
_files = files;
|
_files = files;
|
||||||
|
@ -38,12 +42,19 @@ namespace Oqtane.Pages
|
||||||
_syncManager = syncManager;
|
_syncManager = syncManager;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_alias = tenantManager.GetAlias();
|
_alias = tenantManager.GetAlias();
|
||||||
|
_imageService = imageService;
|
||||||
|
_settingRepository = settingRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult OnGet(string path)
|
public IActionResult OnGet(string path)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt - Path Not Specified For Site {SiteId}", _alias.SiteId);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
path = path.Replace("\\", "/");
|
path = path.Replace("\\", "/");
|
||||||
var folderpath = "";
|
var folderpath = "";
|
||||||
var filename = "";
|
var filename = "";
|
||||||
|
@ -74,56 +85,10 @@ namespace Oqtane.Pages
|
||||||
file = _files.GetFile(_alias.SiteId, folderpath, filename);
|
file = _files.GetFile(_alias.SiteId, folderpath, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file != null)
|
if (file == null)
|
||||||
{
|
|
||||||
if (file.Folder.SiteId == _alias.SiteId && _userPermissions.IsAuthorized(User, PermissionNames.View, file.Folder.PermissionList))
|
|
||||||
{
|
|
||||||
// calculate ETag using last modified date and file size
|
|
||||||
var etag = Convert.ToString(file.ModifiedOn.Ticks ^ file.Size, 16);
|
|
||||||
|
|
||||||
var header = "";
|
|
||||||
if (HttpContext.Request.Headers.ContainsKey(HeaderNames.IfNoneMatch))
|
|
||||||
{
|
|
||||||
header = HttpContext.Request.Headers[HeaderNames.IfNoneMatch].ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!header.Equals(etag))
|
|
||||||
{
|
|
||||||
var filepath = _files.GetFilePath(file);
|
|
||||||
if (System.IO.File.Exists(filepath))
|
|
||||||
{
|
|
||||||
if (download)
|
|
||||||
{
|
|
||||||
_syncManager.AddSyncEvent(_alias, EntityNames.File, file.FileId, "Download");
|
|
||||||
return PhysicalFile(filepath, file.GetMimeType(), file.Name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HttpContext.Response.Headers.Append(HeaderNames.ETag, etag);
|
|
||||||
return PhysicalFile(filepath, file.GetMimeType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {FilePath}", filepath);
|
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotModified;
|
|
||||||
return Content(String.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt For Site {SiteId} And Path {Path}", _alias.SiteId, path);
|
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// look for url mapping
|
// look for url mapping
|
||||||
|
|
||||||
var urlMapping = _urlMappings.GetUrlMapping(_alias.SiteId, "files/" + folderpath + filename);
|
var urlMapping = _urlMappings.GetUrlMapping(_alias.SiteId, "files/" + folderpath + filename);
|
||||||
if (urlMapping != null && !string.IsNullOrEmpty(urlMapping.MappedUrl))
|
if (urlMapping != null && !string.IsNullOrEmpty(urlMapping.MappedUrl))
|
||||||
{
|
{
|
||||||
|
@ -133,16 +98,172 @@ namespace Oqtane.Pages
|
||||||
var uri = new Uri(HttpContext.Request.GetEncodedUrl());
|
var uri = new Uri(HttpContext.Request.GetEncodedUrl());
|
||||||
url = uri.Scheme + "://" + uri.Authority + ((!string.IsNullOrEmpty(_alias.Path)) ? "/" + _alias.Path : "") + "/" + url;
|
url = uri.Scheme + "://" + uri.Authority + ((!string.IsNullOrEmpty(_alias.Path)) ? "/" + _alias.Path : "") + "/" + url;
|
||||||
}
|
}
|
||||||
return RedirectPermanent(url);
|
|
||||||
}
|
// appends the query string to the redirect url
|
||||||
}
|
if (Request.QueryString.HasValue && !string.IsNullOrWhiteSpace(Request.QueryString.Value))
|
||||||
|
{
|
||||||
|
if (url.Contains('?'))
|
||||||
|
{
|
||||||
|
url += "&";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt - Path Not Specified For Site {SiteId}", _alias.SiteId);
|
url += "?";
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
url += Request.QueryString.Value.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectPermanent(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.Folder.SiteId != _alias.SiteId || !_userPermissions.IsAuthorized(User, PermissionNames.View, file.Folder.PermissionList))
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt For Site {SiteId} And Path {Path}", _alias.SiteId, path);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
string etag;
|
||||||
|
string downloadName = file.Name;
|
||||||
|
string filepath = _files.GetFilePath(file);
|
||||||
|
|
||||||
|
var etagValue = file.ModifiedOn.Ticks ^ file.Size;
|
||||||
|
|
||||||
|
bool isRequestingImageManipulation = false;
|
||||||
|
|
||||||
|
int width = 0;
|
||||||
|
int height = 0;
|
||||||
|
if (Request.Query.TryGetValue("width", out var widthStr) && int.TryParse(widthStr, out width) && width > 0)
|
||||||
|
{
|
||||||
|
isRequestingImageManipulation = true;
|
||||||
|
etagValue ^= (width * 31);
|
||||||
|
}
|
||||||
|
if (Request.Query.TryGetValue("height", out var heightStr) && int.TryParse(heightStr, out height) && height > 0)
|
||||||
|
{
|
||||||
|
isRequestingImageManipulation = true;
|
||||||
|
etagValue ^= (height * 17);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request.Query.TryGetValue("mode", out var mode);
|
||||||
|
Request.Query.TryGetValue("position", out var position);
|
||||||
|
Request.Query.TryGetValue("background", out var background);
|
||||||
|
|
||||||
|
if (width > 0 || height > 0)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(mode)) etagValue ^= mode.ToString().GetHashCode();
|
||||||
|
if (!string.IsNullOrWhiteSpace(position)) etagValue ^= position.ToString().GetHashCode();
|
||||||
|
if (!string.IsNullOrWhiteSpace(background)) etagValue ^= background.ToString().GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
int rotate;
|
||||||
|
if (Request.Query.TryGetValue("rotate", out var rotateStr) && int.TryParse(rotateStr, out rotate) && 360 > rotate && rotate > 0)
|
||||||
|
{
|
||||||
|
isRequestingImageManipulation = true;
|
||||||
|
etagValue ^= (rotate * 13);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Request.Query.TryGetValue("format", out var format) && _imageService.GetAvailableFormats().Contains(format.ToString()))
|
||||||
|
{
|
||||||
|
isRequestingImageManipulation = true;
|
||||||
|
etagValue ^= format.ToString().GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
etag = Convert.ToString(etagValue, 16);
|
||||||
|
|
||||||
|
var header = "";
|
||||||
|
if (HttpContext.Request.Headers.TryGetValue(HeaderNames.IfNoneMatch, out var ifNoneMatch))
|
||||||
|
{
|
||||||
|
header = ifNoneMatch.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header.Equals(etag))
|
||||||
|
{
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotModified;
|
||||||
|
return Content(String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists(filepath))
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {FilePath}", filepath);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRequestingImageManipulation)
|
||||||
|
{
|
||||||
|
var _ImageFiles = _settingRepository.GetSetting(EntityNames.Site, _alias.SiteId, "ImageFiles")?.SettingValue;
|
||||||
|
_ImageFiles = (string.IsNullOrEmpty(_ImageFiles)) ? Constants.ImageFiles : _ImageFiles;
|
||||||
|
|
||||||
|
if (!_ImageFiles.Split(',').Contains(file.Extension.ToLower()))
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "File Is Not An Image {File}", file);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
Request.Query.TryGetValue("recreate", out var recreate);
|
||||||
|
|
||||||
|
if (!bool.TryParse(recreate, out _)) recreate = "false";
|
||||||
|
if (!_imageService.GetAvailableFormats().Contains(format.ToString())) format = "png";
|
||||||
|
if (width == 0 && height == 0)
|
||||||
|
{
|
||||||
|
width = file.ImageWidth;
|
||||||
|
height = file.ImageHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
string imagepath = filepath.Replace(Path.GetExtension(filepath), "." + width.ToString() + "x" + height.ToString() + "." + format);
|
||||||
|
if (!System.IO.File.Exists(imagepath) || bool.Parse(recreate))
|
||||||
|
{
|
||||||
|
// user has edit access to folder or folder supports the image size being created
|
||||||
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Edit, file.Folder.PermissionList) ||
|
||||||
|
(!string.IsNullOrEmpty(file.Folder.ImageSizes) && (file.Folder.ImageSizes == "*" || file.Folder.ImageSizes.ToLower().Split(",").Contains(width.ToString() + "x" + height.ToString()))))
|
||||||
|
{
|
||||||
|
imagepath = _imageService.CreateImage(filepath, width, height, mode, position, background, rotateStr, format, imagepath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Invalid Image Size For Folder {Folder} {Width} {Height}", file.Folder, width, height);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(imagepath))
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Create, "Error Displaying Image For File {File} {Width} {Height}", file, widthStr, heightStr);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadName = file.Name.Replace(Path.GetExtension(filepath), "." + width.ToString() + "x" + height.ToString() + "." + format);
|
||||||
|
filepath = imagepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists(filepath))
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {FilePath}", filepath);
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return BrokenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (download)
|
||||||
|
{
|
||||||
|
_syncManager.AddSyncEvent(_alias, EntityNames.File, file.FileId, "Download");
|
||||||
|
return PhysicalFile(filepath, file.GetMimeType(), downloadName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HttpContext.Response.Headers.Append(HeaderNames.ETag, etag);
|
||||||
|
return PhysicalFile(filepath, file.GetMimeType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PhysicalFileResult BrokenFile()
|
||||||
|
{
|
||||||
// broken link
|
// broken link
|
||||||
string errorPath = Path.Combine(Utilities.PathCombine(_environment.ContentRootPath, "wwwroot/images"), "error.png");
|
string errorPath = Path.Combine(Utilities.PathCombine(_environment.ContentRootPath, "wwwroot/images"), "error.png");
|
||||||
return PhysicalFile(errorPath, MimeUtilities.GetMimeType(errorPath));
|
return PhysicalFile(errorPath, MimeUtilities.GetMimeType(errorPath));
|
||||||
|
|
|
@ -91,6 +91,7 @@ namespace Oqtane.Repository
|
||||||
public void DeletePage(int pageId)
|
public void DeletePage(int pageId)
|
||||||
{
|
{
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
|
{
|
||||||
var page = db.Page.Find(pageId);
|
var page = db.Page.Find(pageId);
|
||||||
_permissions.DeletePermissions(page.SiteId, EntityNames.Page, pageId);
|
_permissions.DeletePermissions(page.SiteId, EntityNames.Page, pageId);
|
||||||
_settings.DeleteSettings(EntityNames.Page, pageId);
|
_settings.DeleteSettings(EntityNames.Page, pageId);
|
||||||
|
@ -100,9 +101,19 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
_pageModules.DeletePageModule(pageModule.PageModuleId);
|
_pageModules.DeletePageModule(pageModule.PageModuleId);
|
||||||
}
|
}
|
||||||
// must occur after page modules are deleted because of cascading delete relationship
|
|
||||||
db.Page.Remove(page);
|
// At this point the page item is unaware of changes happened in other
|
||||||
db.SaveChanges();
|
// contexts (i.e.: the contex opened and closed in each DeletePageModule).
|
||||||
|
// Workin on page item may result in unxpected behaviour:
|
||||||
|
// better close and reopen context to work on a fresh page item.
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
{
|
||||||
|
var page = dbContext.Page.Find(pageId);
|
||||||
|
dbContext.Page.Remove(page);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ namespace Oqtane.Repository
|
||||||
userrole.RoleId = role.RoleId;
|
userrole.RoleId = role.RoleId;
|
||||||
userrole.EffectiveDate = null;
|
userrole.EffectiveDate = null;
|
||||||
userrole.ExpiryDate = null;
|
userrole.ExpiryDate = null;
|
||||||
|
userrole.IgnoreSecurityStamp = true;
|
||||||
_userroles.AddUserRole(userrole);
|
_userroles.AddUserRole(userrole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,12 @@ namespace Oqtane.Repository
|
||||||
DeleteUserRoles(userRole.UserId);
|
DeleteUserRoles(userRole.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!userRole.IgnoreSecurityStamp)
|
||||||
|
{
|
||||||
UpdateSecurityStamp(userRole.UserId);
|
UpdateSecurityStamp(userRole.UserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshCache(userRole.UserId);
|
||||||
|
|
||||||
return userRole;
|
return userRole;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +88,12 @@ namespace Oqtane.Repository
|
||||||
db.Entry(userRole).State = EntityState.Modified;
|
db.Entry(userRole).State = EntityState.Modified;
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
|
if (!userRole.IgnoreSecurityStamp)
|
||||||
|
{
|
||||||
UpdateSecurityStamp(userRole.UserId);
|
UpdateSecurityStamp(userRole.UserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshCache(userRole.UserId);
|
||||||
|
|
||||||
return userRole;
|
return userRole;
|
||||||
}
|
}
|
||||||
|
@ -144,6 +154,7 @@ namespace Oqtane.Repository
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
UpdateSecurityStamp(userRole.UserId);
|
UpdateSecurityStamp(userRole.UserId);
|
||||||
|
RefreshCache(userRole.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteUserRoles(int userId)
|
public void DeleteUserRoles(int userId)
|
||||||
|
@ -156,11 +167,11 @@ namespace Oqtane.Repository
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
UpdateSecurityStamp(userId);
|
UpdateSecurityStamp(userId);
|
||||||
|
RefreshCache(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSecurityStamp(int userId)
|
private void UpdateSecurityStamp(int userId)
|
||||||
{
|
{
|
||||||
// update user security stamp
|
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
var user = db.User.Find(userId);
|
var user = db.User.Find(userId);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
|
@ -168,11 +179,13 @@ namespace Oqtane.Repository
|
||||||
var identityuser = _identityUserManager.FindByNameAsync(user.Username).GetAwaiter().GetResult();
|
var identityuser = _identityUserManager.FindByNameAsync(user.Username).GetAwaiter().GetResult();
|
||||||
if (identityuser != null)
|
if (identityuser != null)
|
||||||
{
|
{
|
||||||
_identityUserManager.UpdateSecurityStampAsync(identityuser);
|
_identityUserManager.UpdateSecurityStampAsync(identityuser).GetAwaiter().GetResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh cache
|
private void RefreshCache(int userId)
|
||||||
|
{
|
||||||
var alias = _tenantManager.GetAlias();
|
var alias = _tenantManager.GetAlias();
|
||||||
if (alias != null)
|
if (alias != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,13 +7,13 @@ using Oqtane.Models;
|
||||||
using Oqtane.Extensions;
|
using Oqtane.Extensions;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Managers;
|
using Oqtane.Managers;
|
||||||
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
|
||||||
namespace Oqtane.Security
|
namespace Oqtane.Security
|
||||||
{
|
{
|
||||||
public static class PrincipalValidator
|
public static class PrincipalValidator
|
||||||
{
|
{
|
||||||
public static Task ValidateAsync(CookieValidatePrincipalContext context)
|
public static async Task ValidateAsync(CookieValidatePrincipalContext context)
|
||||||
{
|
{
|
||||||
if (context != null && context.Principal.Identity.IsAuthenticated && context.Principal.Identity.Name != null)
|
if (context != null && context.Principal.Identity.IsAuthenticated && context.Principal.Identity.Name != null)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ namespace Oqtane.Security
|
||||||
// remove principal (ie. log user out)
|
// remove principal (ie. log user out)
|
||||||
Log(_logger, alias, "Permissions Removed For User {Username} Accessing {Url}", context.Principal.Identity.Name, path);
|
Log(_logger, alias, "Permissions Removed For User {Username} Accessing {Url}", context.Principal.Identity.Name, path);
|
||||||
context.RejectPrincipal();
|
context.RejectPrincipal();
|
||||||
|
await context.HttpContext.SignOutAsync(Constants.AuthenticationScheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -58,7 +59,6 @@ namespace Oqtane.Security
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Log (ILogManager logger, Alias alias, string message, string username, string path)
|
private static void Log (ILogManager logger, Alias alias, string message, string username, string path)
|
||||||
|
|
124
Oqtane.Server/Services/ImageService.cs
Normal file
124
Oqtane.Server/Services/ImageService.cs
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
using Oqtane.Enums;
|
||||||
|
using SixLabors.ImageSharp.Formats.Png;
|
||||||
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
using System.IO;
|
||||||
|
using System;
|
||||||
|
using SixLabors.ImageSharp;
|
||||||
|
using Oqtane.Infrastructure;
|
||||||
|
using Oqtane.Shared;
|
||||||
|
using SixLabors.ImageSharp.Formats;
|
||||||
|
using SixLabors.ImageSharp.Formats.Webp;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Oqtane.Services
|
||||||
|
{
|
||||||
|
public class ImageService : IImageService
|
||||||
|
{
|
||||||
|
private readonly ILogManager _logger;
|
||||||
|
private static readonly string[] _formats = ["png", "webp"];
|
||||||
|
|
||||||
|
public ImageService(ILogManager logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] GetAvailableFormats()
|
||||||
|
{
|
||||||
|
return _formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreateImage(string filepath, int width, int height, string mode, string position, string background, string rotate, string format, string imagepath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// params validation
|
||||||
|
if (!Enum.TryParse(mode, true, out ResizeMode _)) mode = "crop";
|
||||||
|
if (!Enum.TryParse(position, true, out AnchorPositionMode _)) position = "center";
|
||||||
|
if (!Color.TryParseHex("#" + background, out _)) background = "transparent";
|
||||||
|
if (!int.TryParse(rotate, out _)) rotate = "0";
|
||||||
|
rotate = (int.Parse(rotate) < 0 || int.Parse(rotate) > 360) ? "0" : rotate;
|
||||||
|
if (!_formats.Contains(format)) format = "png";
|
||||||
|
|
||||||
|
using (var stream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
stream.Position = 0;
|
||||||
|
using (var image = Image.Load(stream))
|
||||||
|
{
|
||||||
|
int.TryParse(rotate, out int angle);
|
||||||
|
Enum.TryParse(mode, true, out ResizeMode resizemode);
|
||||||
|
Enum.TryParse(position, true, out AnchorPositionMode anchorpositionmode);
|
||||||
|
|
||||||
|
if (width == 0 && height == 0)
|
||||||
|
{
|
||||||
|
width = image.Width;
|
||||||
|
height = image.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
IImageEncoder encoder;
|
||||||
|
var resizeOptions = new ResizeOptions
|
||||||
|
{
|
||||||
|
Mode = resizemode,
|
||||||
|
Position = anchorpositionmode,
|
||||||
|
Size = new Size(width, height)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (background != "transparent")
|
||||||
|
{
|
||||||
|
resizeOptions.PadColor = Color.ParseHex("#" + background);
|
||||||
|
encoder = GetEncoder(format, transparent: false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
encoder = GetEncoder(format, transparent: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
image.Mutate(x => x
|
||||||
|
.AutoOrient() // auto orient the image
|
||||||
|
.Rotate(angle)
|
||||||
|
.Resize(resizeOptions));
|
||||||
|
|
||||||
|
image.Save(imagepath, encoder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, ex, "Error Creating Image For File {FilePath} {Width} {Height} {Mode} {Rotate} {Error}", filepath, width, height, mode, rotate, ex.Message);
|
||||||
|
imagepath = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return imagepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IImageEncoder GetEncoder(string format, bool transparent)
|
||||||
|
{
|
||||||
|
return format switch
|
||||||
|
{
|
||||||
|
"png" => GetPngEncoder(transparent),
|
||||||
|
"webp" => GetWebpEncoder(transparent),
|
||||||
|
_ => GetPngEncoder(transparent),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PngEncoder GetPngEncoder(bool transparent)
|
||||||
|
{
|
||||||
|
return new PngEncoder()
|
||||||
|
{
|
||||||
|
ColorType = transparent ? PngColorType.RgbWithAlpha : PngColorType.Rgb,
|
||||||
|
TransparentColorMode = transparent ? PngTransparentColorMode.Preserve : PngTransparentColorMode.Clear,
|
||||||
|
BitDepth = PngBitDepth.Bit8,
|
||||||
|
CompressionLevel = PngCompressionLevel.BestSpeed
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static WebpEncoder GetWebpEncoder(bool transparent)
|
||||||
|
{
|
||||||
|
return new WebpEncoder()
|
||||||
|
{
|
||||||
|
FileFormat = WebpFileFormatType.Lossy,
|
||||||
|
Quality = 60,
|
||||||
|
TransparentColorMode = transparent ? WebpTransparentColorMode.Preserve : WebpTransparentColorMode.Clear,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -92,6 +92,13 @@ namespace Oqtane.Services
|
||||||
}
|
}
|
||||||
site.Pages = pages;
|
site.Pages = pages;
|
||||||
|
|
||||||
|
// get language display name for user
|
||||||
|
foreach (Language language in site.Languages)
|
||||||
|
{
|
||||||
|
language.Name = CultureInfo.GetCultureInfo(language.Code).DisplayName;
|
||||||
|
}
|
||||||
|
site.Languages = site.Languages.OrderBy(item => item.Name).ToList();
|
||||||
|
|
||||||
return Task.FromResult(site);
|
return Task.FromResult(site);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +137,10 @@ namespace Oqtane.Services
|
||||||
// languages
|
// languages
|
||||||
site.Languages = _languages.GetLanguages(site.SiteId).ToList();
|
site.Languages = _languages.GetLanguages(site.SiteId).ToList();
|
||||||
var defaultCulture = CultureInfo.GetCultureInfo(Constants.DefaultCulture);
|
var defaultCulture = CultureInfo.GetCultureInfo(Constants.DefaultCulture);
|
||||||
site.Languages.Add(new Language { Code = defaultCulture.Name, Name = defaultCulture.DisplayName, Version = Constants.Version, IsDefault = !site.Languages.Any(l => l.IsDefault) });
|
if (!site.Languages.Exists(item => item.Code == defaultCulture.Name))
|
||||||
|
{
|
||||||
|
site.Languages.Add(new Language { Code = defaultCulture.Name, Name = "", Version = Constants.Version, IsDefault = !site.Languages.Any(l => l.IsDefault) });
|
||||||
|
}
|
||||||
|
|
||||||
// themes
|
// themes
|
||||||
site.Themes = _themes.FilterThemes(_themes.GetThemes().ToList());
|
site.Themes = _themes.FilterThemes(_themes.GetThemes().ToList());
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace Oqtane
|
||||||
}
|
}
|
||||||
}).AddHubOptions(options =>
|
}).AddHubOptions(options =>
|
||||||
{
|
{
|
||||||
options.MaximumReceiveMessageSize = null; // no limit (for large amnounts of data ie. textarea components)
|
options.MaximumReceiveMessageSize = null; // no limit (for large amounts of data ie. textarea components)
|
||||||
})
|
})
|
||||||
.AddInteractiveWebAssemblyComponents();
|
.AddInteractiveWebAssemblyComponents();
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
|
<PackageReference Include="System.Net.Http.Json" Version="8.0.5" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
var Oqtane = Oqtane || {};
|
var Oqtane = Oqtane || {};
|
||||||
|
|
||||||
Oqtane.Interop = {
|
Oqtane.Interop = {
|
||||||
setCookie: function (name, value, days) {
|
setCookie: function (name, value, days, secure, sameSite) {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||||
var expires = "expires=" + d.toUTCString();
|
var expires = "expires=" + d.toUTCString();
|
||||||
document.cookie = name + "=" + value + ";" + expires + ";path=/";
|
var cookieString = name + "=" + value + ";" + expires + ";path=/";
|
||||||
|
if (secure) {
|
||||||
|
cookieString += "; secure";
|
||||||
|
}
|
||||||
|
if (sameSite === "Lax" || sameSite === "Strict" || sameSite === "None") {
|
||||||
|
cookieString += "; SameSite=" + sameSite;
|
||||||
|
}
|
||||||
|
document.cookie = cookieString;
|
||||||
},
|
},
|
||||||
getCookie: function (name) {
|
getCookie: function (name) {
|
||||||
name = name + "=";
|
name = name + "=";
|
||||||
|
|
15
Oqtane.Shared/Interfaces/IImageService.cs
Normal file
15
Oqtane.Shared/Interfaces/IImageService.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Oqtane.Services
|
||||||
|
{
|
||||||
|
public interface IImageService
|
||||||
|
{
|
||||||
|
public string[] GetAvailableFormats();
|
||||||
|
|
||||||
|
public string CreateImage(string filepath, int width, int height, string mode, string position, string background, string rotate, string format, string imagepath);
|
||||||
|
}
|
||||||
|
}
|
11
Oqtane.Shared/Models/ExternalLoginProvider.cs
Normal file
11
Oqtane.Shared/Models/ExternalLoginProvider.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Oqtane.Models
|
||||||
|
{
|
||||||
|
public class ExternalLoginProvider
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<string, string> Settings { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,11 +19,6 @@ namespace Oqtane.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? SiteId { get; set; }
|
public int? SiteId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Language Name - corresponds to <see cref="Culture.DisplayName"/>, _not_ <see cref="Culture.Name"/>
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Language / Culture code, like 'en-US' - corresponds to <see cref="Culture.Name"/>
|
/// Language / Culture code, like 'en-US' - corresponds to <see cref="Culture.Name"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -34,6 +29,12 @@ namespace Oqtane.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDefault { get; set; }
|
public bool IsDefault { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
/// <summary>
|
||||||
|
/// Language Name - corresponds to <see cref="Culture.DisplayName"/>, _not_ <see cref="Culture.Name"/>
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the satellite assembly
|
/// Version of the satellite assembly
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Oqtane.Models
|
namespace Oqtane.Models
|
||||||
{
|
{
|
||||||
|
@ -26,11 +27,18 @@ namespace Oqtane.Models
|
||||||
/// Start of when this assignment is valid. See also <see cref="ExpiryDate"/>
|
/// Start of when this assignment is valid. See also <see cref="ExpiryDate"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EffectiveDate { get; set; }
|
public DateTime? EffectiveDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// End of when this assignment is valid. See also <see cref="EffectiveDate"/>
|
/// End of when this assignment is valid. See also <see cref="EffectiveDate"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? ExpiryDate { get; set; }
|
public DateTime? ExpiryDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the User Security Stamp should not be updated when this user role is added or updated
|
||||||
|
/// </summary>
|
||||||
|
[NotMapped]
|
||||||
|
public bool IgnoreSecurityStamp { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Direct reference to the <see cref="Role"/> object.
|
/// Direct reference to the <see cref="Role"/> object.
|
||||||
/// TODO: todoc - is this always populated?
|
/// TODO: todoc - is this always populated?
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
|
@ -19,11 +19,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="8.0.4" />
|
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -4,8 +4,8 @@ namespace Oqtane.Shared
|
||||||
{
|
{
|
||||||
public class Constants
|
public class Constants
|
||||||
{
|
{
|
||||||
public static readonly string Version = "5.2.3";
|
public static readonly string Version = "5.2.4";
|
||||||
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.0.3,5.1.0,5.1.1,5.1.2,5.2.0,5.2.1,5.2.2,5.2.3";
|
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.0.3,5.1.0,5.1.1,5.1.2,5.2.0,5.2.1,5.2.2,5.2.3,5.2.4";
|
||||||
public const string PackageId = "Oqtane.Framework";
|
public const string PackageId = "Oqtane.Framework";
|
||||||
public const string ClientId = "Oqtane.Client";
|
public const string ClientId = "Oqtane.Client";
|
||||||
public const string UpdaterPackageId = "Oqtane.Updater";
|
public const string UpdaterPackageId = "Oqtane.Updater";
|
||||||
|
|
89
Oqtane.Shared/Shared/ExternalLoginProviders.cs
Normal file
89
Oqtane.Shared/Shared/ExternalLoginProviders.cs
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Oqtane.Models;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared
|
||||||
|
{
|
||||||
|
public class ExternalLoginProviders
|
||||||
|
{
|
||||||
|
public static List<ExternalLoginProvider> Providers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var providers = new List<ExternalLoginProvider>
|
||||||
|
{
|
||||||
|
new ExternalLoginProvider
|
||||||
|
{
|
||||||
|
Name = "<Custom>",
|
||||||
|
Settings = new Dictionary<string, string>()
|
||||||
|
},
|
||||||
|
// OIDC
|
||||||
|
new ExternalLoginProvider
|
||||||
|
{
|
||||||
|
Name = "Microsoft Entra",
|
||||||
|
Settings = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "ExternalLogin:ProviderUrl", "https://entra.microsoft.com" },
|
||||||
|
{ "ExternalLogin:ProviderType", "oidc" },
|
||||||
|
{ "ExternalLogin:ProviderName", "Microsoft Entra" },
|
||||||
|
{ "ExternalLogin:Authority", "https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0" },
|
||||||
|
{ "ExternalLogin:ClientId", "YOUR CLIENT ID" },
|
||||||
|
{ "ExternalLogin:ClientSecret", "YOUR CLIENT SECRET" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new ExternalLoginProvider
|
||||||
|
{
|
||||||
|
Name = "Auth0 (by Okta)",
|
||||||
|
Settings = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "ExternalLogin:ProviderUrl", "https://auth0.com/docs/get-started" },
|
||||||
|
{ "ExternalLogin:ProviderType", "oidc" },
|
||||||
|
{ "ExternalLogin:ProviderName", "Auth0" },
|
||||||
|
{ "ExternalLogin:Authority", "YOUR DOMAIN" },
|
||||||
|
{ "ExternalLogin:ClientId", "YOUR CLIENT ID" },
|
||||||
|
{ "ExternalLogin:ClientSecret", "YOUR CLIENT SECRET" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// OAuth2
|
||||||
|
new ExternalLoginProvider
|
||||||
|
{
|
||||||
|
Name = "GitHub",
|
||||||
|
Settings = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "ExternalLogin:ProviderUrl", "https://github.com/settings/developers#oauth-apps" },
|
||||||
|
{ "ExternalLogin:ProviderType", "oauth2" },
|
||||||
|
{ "ExternalLogin:ProviderName", "GitHub" },
|
||||||
|
{ "ExternalLogin:AuthorizationUrl", "https://github.com/login/oauth/authorize" },
|
||||||
|
{ "ExternalLogin:TokenUrl", "https://github.com/login/oauth/access_token" },
|
||||||
|
{ "ExternalLogin:UserInfoUrl", "https://api.github.com/user/emails" },
|
||||||
|
{ "ExternalLogin:ClientId", "YOUR CLIENT ID" },
|
||||||
|
{ "ExternalLogin:ClientSecret", "YOUR CLIENT SECRET" },
|
||||||
|
{ "ExternalLogin:Scopes", "user:email" },
|
||||||
|
{ "ExternalLogin:IdentifierClaimType", "email" },
|
||||||
|
{ "ExternalLogin:DomainFilter", "!users.noreply.github.com" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new ExternalLoginProvider
|
||||||
|
{
|
||||||
|
Name = "Facebook",
|
||||||
|
Settings = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "ExternalLogin:ProviderUrl", "https://developers.facebook.com/apps/" },
|
||||||
|
{ "ExternalLogin:ProviderType", "oauth2" },
|
||||||
|
{ "ExternalLogin:ProviderName", "Facebook" },
|
||||||
|
{ "ExternalLogin:AuthorizationUrl", "https://www.facebook.com/v18.0/dialog/oauth" },
|
||||||
|
{ "ExternalLogin:TokenUrl", "https://graph.facebook.com/v18.0/oauth/access_token" },
|
||||||
|
{ "ExternalLogin:UserInfoUrl", "https://graph.facebook.com/v18.0/me" },
|
||||||
|
{ "ExternalLogin:ClientId", "YOUR CLIENT ID" },
|
||||||
|
{ "ExternalLogin:ClientSecret", "YOUR CLIENT SECRET" },
|
||||||
|
{ "ExternalLogin:Scopes", "public_profile" },
|
||||||
|
{ "ExternalLogin:IdentifierClaimType", "id" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return providers.OrderBy(item => item.Name).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Version>5.2.3</Version>
|
<Version>5.2.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<Copyright>.NET Foundation</Copyright>
|
<Copyright>.NET Foundation</Copyright>
|
||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE</PackageLicenseUrl>
|
||||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.4</PackageReleaseNotes>
|
||||||
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane/oqtane.framework</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
|
|
11
README.md
11
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Latest Release
|
# Latest Release
|
||||||
|
|
||||||
[5.2.2](https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.2) was released on September 23, 2024 and is a maintenance release including 55 pull requests by 8 different contributors, pushing the total number of project commits all-time to over 5800. The Oqtane framework continues to evolve at a rapid pace to meet the needs of .NET developers.
|
[5.2.3](https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3) was released on September 23, 2024 and is a maintenance release including 55 pull requests by 8 different contributors, pushing the total number of project commits all-time to over 5800. The Oqtane framework continues to evolve at a rapid pace to meet the needs of .NET developers.
|
||||||
|
|
||||||
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Foqtane%2Foqtane.framework%2Fmaster%2Fazuredeploy.json)
|
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Foqtane%2Foqtane.framework%2Fmaster%2Fazuredeploy.json)
|
||||||
|
|
||||||
|
@ -75,6 +75,12 @@ Explore and enhance your Oqtane experience by visiting the Oqtane Marketplace. D
|
||||||
# Documentation
|
# Documentation
|
||||||
There is a separate [Documentation repository](https://github.com/oqtane/oqtane.docs) which contains a variety of types of documentation for Oqtane, including API documentation that is auto generated using Docfx. The contents of the repository is published to Githib Pages and is available at [https://docs.oqtane.org](https://docs.oqtane.org/)
|
There is a separate [Documentation repository](https://github.com/oqtane/oqtane.docs) which contains a variety of types of documentation for Oqtane, including API documentation that is auto generated using Docfx. The contents of the repository is published to Githib Pages and is available at [https://docs.oqtane.org](https://docs.oqtane.org/)
|
||||||
|
|
||||||
|
# Join the Community
|
||||||
|
|
||||||
|
Connect with other developers, get support, and share ideas by joining the Oqtane community on Discord!
|
||||||
|
|
||||||
|
[](https://discord.gg/BnPny88avK)
|
||||||
|
|
||||||
# Roadmap
|
# Roadmap
|
||||||
This project is open source, and therefore is a work in progress...
|
This project is open source, and therefore is a work in progress...
|
||||||
|
|
||||||
|
@ -83,6 +89,9 @@ Backlog (TBD)
|
||||||
- [ ] Folder Providers
|
- [ ] Folder Providers
|
||||||
- [ ] Generative AI Integration
|
- [ ] Generative AI Integration
|
||||||
|
|
||||||
|
[5.2.3](https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.3) (Sep 23, 2024)
|
||||||
|
- [x] Stabilization improvements
|
||||||
|
|
||||||
[5.2.2](https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.2) (Sep 23, 2024)
|
[5.2.2](https://github.com/oqtane/oqtane.framework/releases/tag/v5.2.2) (Sep 23, 2024)
|
||||||
- [x] Stabilization improvements
|
- [x] Stabilization improvements
|
||||||
- [x] Support for Security Stamp to faciliate Logout Everywhere
|
- [x] Support for Security Stamp to faciliate Logout Everywhere
|
||||||
|
|
Loading…
Reference in New Issue
Block a user