diff --git a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor index b0635053..c83fc7db 100644 --- a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor +++ b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor @@ -1,4 +1,5 @@ @attribute [Route(Routes.ASSISTANT_EDI)] +@using MudExtensions @inherits AssistantBaseCore @@ -45,4 +46,23 @@ } + + + @foreach (var authMethod in Enum.GetValues()) + { + @authMethod.Name() + } + + + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs index 7a5f2b53..e4462a51 100644 --- a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs +++ b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs @@ -46,6 +46,8 @@ public partial class AssistantEDI : AssistantBaseCore private string otherProgrammingLanguage = string.Empty; private DataSources selectedDataSource = DataSources.NONE; private string otherDataSource = string.Empty; + private IEnumerable selectedAuthenticationMethods = new HashSet(); + private string authDescription = string.Empty; private string? ValidateProgrammingLanguage(ProgrammingLanguages language) { @@ -90,4 +92,36 @@ public partial class AssistantEDI : AssistantBaseCore return null; } + + private string? ValidateAuthenticationMethods(Auth _) + { + var authenticationMethods = (this.selectedAuthenticationMethods as HashSet)!; + if(authenticationMethods.Count == 0) + return "Please select at least one authentication method for the EDI server."; + + return null; + } + + private string? ValidateAuthDescription(string description) + { + var authenticationMethods = (this.selectedAuthenticationMethods as HashSet)!; + if(authenticationMethods.Any(n => n == Auth.NONE) && authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription)) + return "Please describe how the selected authentication methods should be used. Especially, explain for what data the NONE method (public access) is used."; + + if(authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription)) + return "Please describe how the selected authentication methods should be used."; + + return null; + } + + private string GetMultiSelectionAuthText(List selectedValues) + { + if(selectedValues.Count == 0) + return "Please select at least one authentication method"; + + if(selectedValues.Count == 1) + return $"You have selected 1 authentication method"; + + return $"You have selected {selectedValues.Count} authentication methods"; + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/Auth.cs b/app/MindWork AI Studio/Assistants/EDI/Auth.cs new file mode 100644 index 00000000..ec66d3f7 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/EDI/Auth.cs @@ -0,0 +1,9 @@ +namespace AIStudio.Assistants.EDI; + +public enum Auth +{ + NONE, + KERBEROS, + USERNAME_PASSWORD, + TOKEN, +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/AuthExtensions.cs b/app/MindWork AI Studio/Assistants/EDI/AuthExtensions.cs new file mode 100644 index 00000000..bc57cd66 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/EDI/AuthExtensions.cs @@ -0,0 +1,15 @@ +namespace AIStudio.Assistants.EDI; + +public static class AuthExtensions +{ + public static string Name(this Auth auth) => auth switch + { + Auth.NONE => "No login necessary: useful for public data sources", + + Auth.KERBEROS => "Login by single-sign-on (SSO) using Kerberos: very complex to implement and to operate, useful for many users", + Auth.USERNAME_PASSWORD => "Login by username and password: simple to implement and to operate, useful for few users; easy to use for users", + Auth.TOKEN => "Login by token: simple to implement and to operate, useful for few users; unusual for many users", + + _ => "Unknown login method" + }; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs b/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs index 35297174..647d4e39 100644 --- a/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs +++ b/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs @@ -30,6 +30,16 @@ public sealed class DataEDI /// public string PreselectedOtherDataSource { get; set; } = string.Empty; + /// + /// Preselect any authentication methods? + /// + public HashSet PreselectedAuthMethods { get; set; } = []; + + /// + /// Do you want to preselect any authentication description? + /// + public string PreselectedAuthDescription { get; set; } = string.Empty; + /// /// The minimum confidence level required for a provider to be considered. ///