();
- this.serverConnectionService.Setup(x => x.ServerConfiguration).Returns(new ServerConfiguration { ServerAddress = "http://localhost.com" });
+
+ var serverConfiguration = new ServerConfiguration
+ {
+ ServerAddress = "http://localhost.com",
+ FullTrustConfiguration = new FullTrustConfiguration()
+ };
+
+ this.serverConnectionService.Setup(x => x.ServerConfiguration).Returns(serverConfiguration);
this.context = new TestContext();
this.viewModel = new LoginViewModel(this.authenticationService.Object, this.serverConnectionService.Object);
this.context.Services.AddSingleton(this.viewModel);
diff --git a/COMET.Web.Common/Components/IndexComponent.razor b/COMET.Web.Common/Components/IndexComponent.razor
index 9e5be980..22f04eb7 100644
--- a/COMET.Web.Common/Components/IndexComponent.razor
+++ b/COMET.Web.Common/Components/IndexComponent.razor
@@ -70,7 +70,7 @@
Connect and Open a Model.
Connect
-
+
diff --git a/COMET.Web.Common/Components/IndexComponent.razor.cs b/COMET.Web.Common/Components/IndexComponent.razor.cs
index 88cf3901..33694aaa 100644
--- a/COMET.Web.Common/Components/IndexComponent.razor.cs
+++ b/COMET.Web.Common/Components/IndexComponent.razor.cs
@@ -70,12 +70,6 @@ public partial class IndexComponent
[Parameter]
public string Redirect { get; set; }
- ///
- /// The condition to check if the full trust checkbox should be visible or not
- ///
- [Parameter]
- public bool FullTrustCheckboxVisible { get; set; }
-
///
/// The
///
diff --git a/COMET.Web.Common/Components/Login.razor b/COMET.Web.Common/Components/Login.razor
index 04279a0b..3f9f2fd1 100644
--- a/COMET.Web.Common/Components/Login.razor
+++ b/COMET.Web.Common/Components/Login.razor
@@ -20,12 +20,13 @@
// limitations under the License.
------------------------------------------------------------------------------->
@namespace COMET.Web.Common.Components
+@using COMET.Web.Common.Enumerations
@inherits DisposableComponent
- @if (string.IsNullOrEmpty(this.ViewModel.ServerConnectionService.ServerConfiguration.ServerAddress))
+ @if (string.IsNullOrEmpty(this.ServerConfiguration.ServerAddress))
{
@@ -61,12 +62,13 @@
- @if (this.FullTrustCheckboxVisible)
+ @if (this.ServerConfiguration.FullTrustConfiguration?.IsVisible == true || this.ServerConfiguration.FullTrustConfiguration?.IsTrusted == FullTrustTrustedKind.UserDefined)
{
diff --git a/COMET.Web.Common/Components/Login.razor.cs b/COMET.Web.Common/Components/Login.razor.cs
index ce34ff5b..573523f2 100644
--- a/COMET.Web.Common/Components/Login.razor.cs
+++ b/COMET.Web.Common/Components/Login.razor.cs
@@ -25,6 +25,7 @@
namespace COMET.Web.Common.Components
{
+ using COMET.Web.Common.Model.Configuration;
using COMET.Web.Common.ViewModels.Components;
using Microsoft.AspNetCore.Components;
@@ -64,13 +65,7 @@ public partial class Login
/// The label for the full trust checkbox field
///
[Parameter]
- public string FullTrustLabel { get; set; } = "FullTrust:";
-
- ///
- /// The condition to check if the full trust checkbox should be visible or not
- ///
- [Parameter]
- public bool FullTrustCheckboxVisible { get; set; } = false;
+ public string FullTrustLabel { get; set; } = "Full Trust:";
///
/// The text of the login button
@@ -92,6 +87,11 @@ public partial class Login
///
public Dictionary FieldsFocusedStatus { get; private set; }
+ ///
+ /// Gets the server configuration
+ ///
+ private ServerConfiguration ServerConfiguration => this.ViewModel.ServerConnectionService.ServerConfiguration;
+
///
/// Method invoked when the component is ready to start, having received its
/// initial parameters from its parent in the render tree.
diff --git a/COMET.Web.Common/Enumerations/FullTrustTrustedKind.cs b/COMET.Web.Common/Enumerations/FullTrustTrustedKind.cs
new file mode 100644
index 00000000..63faf5d6
--- /dev/null
+++ b/COMET.Web.Common/Enumerations/FullTrustTrustedKind.cs
@@ -0,0 +1,47 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) 2024 Starion Group S.A.
+//
+// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
+//
+// This file is part of COMET WEB Community Edition
+// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
+//
+// The COMET WEB Community Edition is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Affero General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// The COMET WEB Community Edition is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace COMET.Web.Common.Enumerations
+{
+ ///
+ /// An enumeration that defines possible values for the full trust trusted configuration
+ ///
+ public enum FullTrustTrustedKind
+ {
+ ///
+ /// The kind selected for when the configuration should be full trust
+ ///
+ FullTrust,
+
+ ///
+ /// The kind selected for when the configuration should be no trust
+ ///
+ NoTrust,
+
+ ///
+ /// The kind selected for when the configuration should be user defined
+ ///
+ UserDefined
+ }
+}
diff --git a/COMET.Web.Common/Model/Configuration/FullTrustConfiguration.cs b/COMET.Web.Common/Model/Configuration/FullTrustConfiguration.cs
new file mode 100644
index 00000000..2c2f5f01
--- /dev/null
+++ b/COMET.Web.Common/Model/Configuration/FullTrustConfiguration.cs
@@ -0,0 +1,44 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) 2024 Starion Group S.A.
+//
+// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
+//
+// This file is part of COMET WEB Community Edition
+// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
+//
+// The COMET WEB Community Edition is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Affero General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// The COMET WEB Community Edition is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace COMET.Web.Common.Model.Configuration
+{
+ using COMET.Web.Common.Enumerations;
+
+ ///
+ /// Holds all of the configuration related to the FullTrust feature
+ ///
+ public class FullTrustConfiguration
+ {
+ ///
+ /// Verifies if the full trust option should be visible
+ ///
+ public bool IsVisible { get; set; } = false;
+
+ ///
+ /// Verifies the kind of trust the full trust feature has
+ ///
+ public FullTrustTrustedKind IsTrusted { get; set; } = FullTrustTrustedKind.UserDefined;
+ }
+}
diff --git a/COMET.Web.Common/Model/Configuration/ServerConfiguration.cs b/COMET.Web.Common/Model/Configuration/ServerConfiguration.cs
index 0d48247b..b732b56f 100644
--- a/COMET.Web.Common/Model/Configuration/ServerConfiguration.cs
+++ b/COMET.Web.Common/Model/Configuration/ServerConfiguration.cs
@@ -39,6 +39,11 @@ public class ServerConfiguration
///
public BookInputConfiguration BookInputConfiguration { get; set; }
+ ///
+ /// The configuration values for the FullTrust feature
+ ///
+ public FullTrustConfiguration FullTrustConfiguration { get; set; }
+
///
/// Gets or sets the . If not filters are specified all the available models are shown
///
diff --git a/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs b/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs
index 498204b3..bdf022af 100644
--- a/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs
+++ b/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs
@@ -24,6 +24,7 @@
namespace COMET.Web.Common.ViewModels.Components
{
+ using COMET.Web.Common.Enumerations;
using COMET.Web.Common.Model.DTO;
using COMET.Web.Common.Services.ConfigurationService;
using COMET.Web.Common.Services.SessionManagement;
@@ -61,6 +62,7 @@ public LoginViewModel(IAuthenticationService authenticationService, IConfigurati
{
this.ServerConnectionService = serverConnectionService;
this.authenticationService = authenticationService;
+ this.ResetAuthenticationDto();
}
///
@@ -89,7 +91,7 @@ public Result AuthenticationResult
///
/// The used for perfoming a login
///
- public AuthenticationDto AuthenticationDto { get; private set; } = new();
+ public AuthenticationDto AuthenticationDto { get; private set; }
///
/// Attempt to login to a COMET Server
@@ -108,10 +110,21 @@ public async Task ExecuteLogin()
if (this.AuthenticationResult.IsSuccess)
{
- this.AuthenticationDto = new AuthenticationDto();
+ this.ResetAuthenticationDto();
}
this.IsLoading = false;
}
+
+ ///
+ /// Resets the property to a new object with the default parameters
+ ///
+ private void ResetAuthenticationDto()
+ {
+ this.AuthenticationDto = new AuthenticationDto()
+ {
+ FullTrust = this.ServerConnectionService.ServerConfiguration?.FullTrustConfiguration?.IsTrusted == FullTrustTrustedKind.FullTrust
+ };
+ }
}
}
diff --git a/COMETwebapp.Tests/Pages/IndexTestFixture.cs b/COMETwebapp.Tests/Pages/IndexTestFixture.cs
index 06dc2338..a46bf865 100644
--- a/COMETwebapp.Tests/Pages/IndexTestFixture.cs
+++ b/COMETwebapp.Tests/Pages/IndexTestFixture.cs
@@ -57,7 +57,6 @@ public class IndexTestFixture
private Mock viewModel;
private TestContext context;
private Mock sessionService;
- private readonly bool fullTrustValue = true;
[SetUp]
public void Setup()
@@ -72,9 +71,6 @@ public void Setup()
this.viewModel = new Mock();
this.viewModel.Setup(x => x.SessionService).Returns(this.sessionService.Object);
- var configuration = new Mock();
- configuration.Setup(x => x.GetSection(Constants.FullTrustSelectionEnabledKey).Value).Returns(this.fullTrustValue.ToString());
-
var loginViewModel = new Mock();
loginViewModel.Setup(x => x.ServerConnectionService.ServerConfiguration).Returns(new ServerConfiguration());
loginViewModel.Setup(x => x.AuthenticationResult).Returns(new Result());
@@ -83,7 +79,6 @@ public void Setup()
this.context.Services.AddSingleton(loginViewModel.Object);
this.context.Services.AddSingleton(this.viewModel.Object);
this.context.Services.AddSingleton(this.sessionService.Object);
- this.context.Services.AddSingleton(configuration.Object);
}
[TearDown]
@@ -97,12 +92,7 @@ public void TearDown()
public void VerifyIndexPageNotAuthorized()
{
var renderer = this.context.RenderComponent();
-
- Assert.Multiple(() =>
- {
- Assert.That(() => renderer.FindComponent(), Throws.Nothing);
- Assert.That(renderer.Instance.FullTrustCheckboxVisible, Is.EqualTo(this.fullTrustValue));
- });
+ Assert.That(() => renderer.FindComponent(), Throws.Nothing);
}
}
}
diff --git a/COMETwebapp/Pages/Index.razor b/COMETwebapp/Pages/Index.razor
index 1532868f..55fb99d7 100644
--- a/COMETwebapp/Pages/Index.razor
+++ b/COMETwebapp/Pages/Index.razor
@@ -20,4 +20,4 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
------------------------------------------------------------------------------->
@page "/"
-
+
diff --git a/COMETwebapp/Pages/Index.razor.cs b/COMETwebapp/Pages/Index.razor.cs
index 20b90173..e5b9e081 100644
--- a/COMETwebapp/Pages/Index.razor.cs
+++ b/COMETwebapp/Pages/Index.razor.cs
@@ -24,8 +24,6 @@
namespace COMETwebapp.Pages
{
- using COMETwebapp.Utilities;
-
using Microsoft.AspNetCore.Components;
///
@@ -39,26 +37,5 @@ public partial class Index
[Parameter]
[SupplyParameterFromQuery]
public string Redirect { get; set; }
-
- ///
- /// Gets or sets the
- ///
- [Inject]
- public IConfiguration Configuration { get; set; }
-
- ///
- /// Gets the condition to check if the full trust checkbox should be visible
- ///
- public bool FullTrustCheckboxVisible { get; private set; }
-
- ///
- /// Method invoked when the component is ready to start, having received its
- /// initial parameters from its parent in the render tree.
- ///
- protected override void OnInitialized()
- {
- base.OnInitialized();
- this.FullTrustCheckboxVisible = bool.Parse(this.Configuration.GetSection(Constants.FullTrustSelectionEnabledKey).Value!);
- }
}
}
diff --git a/COMETwebapp/Utilities/Constants.cs b/COMETwebapp/Utilities/Constants.cs
index e1b7cea6..dec6c2f5 100644
--- a/COMETwebapp/Utilities/Constants.cs
+++ b/COMETwebapp/Utilities/Constants.cs
@@ -33,10 +33,5 @@ public static class Constants
/// The name of the configuration key used to retrieve the max upload file size, in megabytes
///
public const string MaxUploadFileSizeInMbConfigurationKey = "MaxUploadFileSizeInMb";
-
- ///
- /// The name of the configuration key used to retrieve the condition to verify if the full trust selection is enabled
- ///
- public const string FullTrustSelectionEnabledKey = "FullTrustSelectionEnabled";
}
}
diff --git a/COMETwebapp/appsettings.json b/COMETwebapp/appsettings.json
index 060057d0..295df06c 100644
--- a/COMETwebapp/appsettings.json
+++ b/COMETwebapp/appsettings.json
@@ -2,9 +2,12 @@
"AllowedHosts": "*",
"StringTablePath": "wwwroot/DefaultTextConfiguration.json",
"MaxUploadFileSizeInMb": 500,
- "FullTrustSelectionEnabled": true,
"ServerConfiguration": {
"ServerAddress": "",
+ "FullTrustConfiguration": {
+ "IsVisible": true,
+ "IsTrusted": "UserDefined"
+ },
"BookInputConfiguration": {
"ShowName": true,
"ShowShortName": true