This commit is contained in:
Meik
2026-03-05 09:56:57 +01:00
parent 838e6b1ee1
commit 4013fa8e32
827 changed files with 743038 additions and 0 deletions

View File

@@ -0,0 +1,633 @@
<Window x:Name="_this"
x:Class="C4IT_CustomerPanel.forms.AuthenticationSettings.AuthenticationSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vc="clr-namespace:C4IT_CustomerPanel.Converter"
xmlns:local="clr-namespace:C4IT_CustomerPanel.forms.AuthenticationSettings"
xmlns:cfgHlp="clr-namespace:C4IT_CustomerPanel.libs"
xmlns:ico="clr-namespace:C4IT.AdaptableIcons;assembly=C4IT-AdaptableIcons"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:usrc="clr-namespace:C4IT_CustomerPanel.UserControls"
mc:Ignorable="d"
Title="AuthenticationSettingsPage"
ShowInTaskbar="False"
Topmost="True"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
MinHeight="100" MinWidth="600" Closed="_this_Closed"
>
<Window.DataContext>
<local:cAuthenticationSettingsController />
</Window.DataContext>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="40" />
</WindowChrome.WindowChrome>
<Window.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<vc:BooleanToVisibiliyConverter x:Key="VisibilityConverter" />
<vc:BooleanToBlurEffectConverter x:Key="BlurConverter" />
<vc:EnumerationComparisonConverter x:Key="EnumerationComparisonConverter" />
<cfgHlp:ConfigClass x:Key="ConfigClass" />
<Style x:Key="DefaultText" TargetType="TextBlock">
<Setter Property="FontSize"
Value="14" />
<Setter Property="FontFamily"
Value="Calibri" />
<Setter Property="FontWeight"
Value="Bold" />
<Setter Property="Foreground"
Value="Black" />
<Setter Property="VerticalAlignment"
Value="Center" />
<Setter Property="Margin"
Value="0 0 0 0" />
</Style>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="OptionMarkFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="14,0,0,0" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SettingsPage.Close.Icon"
TargetType="ico:AdaptableIcon">
<Setter Property="Cursor"
Value="Hand" />
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon}" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome"
Value="True" />
<Setter Property="BorderPadding"
Value="10"/>
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="Menu.MenuBar.PinnedIcon.Base"
TargetType="ico:AdaptableIcon">
<Setter Property="Margin"
Value="5, 0, 5, 0" />
<Setter Property="IconBackgroundColor"
Value="Transparent" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="IconHeight"
Value="30" />
<Setter Property="IconWidth"
Value="30" />
<Setter Property="BorderPadding"
Value="5" />
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon}" />
</Style>
<Style x:Key="Menu.MenuBar.PinnedIcon.Pinned"
TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Base}">
<Setter Property="Cursor"
Value="Hand" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="IconHeight"
Value="36" />
<Setter Property="IconWidth"
Value="36" />
<Setter Property="Margin"
Value="2, -3, 2, -3" />
<Setter Property="BorderPadding"
Value="7.5" />
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon}" />
<Setter Property="IconBackgroundColor"
Value="{DynamicResource Background.Menu.Icon.Hover}" />
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Pinned}">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource FontColor.Menu.Categories}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
Value="True">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="BlurMaskBoarder" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource Color.BlurBorder}"/>
<Setter Property="Opacity" Value="0.4"/>
<Setter Property="CornerRadius" Value="7.5"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Margin" Value="0 0"/>
<Setter Property="Visibility" Value="{Binding Path=visibilityBlurMask, Converter={StaticResource VisibilityConverter}}"/>
<Setter Property="Grid.RowSpan" Value="999"/>
<Setter Property="Grid.ColumnSpan" Value="999"/>
</Style>
</Window.Resources>
<Border
CornerRadius="10"
Background="#FFEEEEEE"
Padding="10"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.SystemTray}"
x:Name="txtHeader"
TextTrimming="CharacterEllipsis"
FontSize="18"
Margin="15,0,0,0"
VerticalAlignment="Center"
FontFamily="Calibri"
FontWeight="Bold"
Grid.Row="0"
Grid.ColumnSpan="3"
Style="{StaticResource DefaultText}"
/>
<ico:AdaptableIcon x:Name="CloseButton"
Grid.Row="0"
HorizontalAlignment="Right"
Style="{DynamicResource SettingsPage.Close.Icon}"
MouseLeftButtonUp="CloseButton_MouseLeftButtonUp"
TouchDown="CloseButton_TouchDown"
SelectedInternIcon="window_close" Grid.Column="2" Margin="335,0,0,0" />
<Grid Grid.Row="1" Effect="{Binding Path=visibilityBlurMask, Converter={StaticResource BlurConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5"
Grid.ColumnSpan="3"
>
<TextBlock Text="You are not currently logged in to Matrix42 WPM."
x:Name="txtCurrentUser"
Margin="0,0,0,0"
FontStyle="Italic"
FontWeight="Normal"
Grid.Row="0"
Grid.ColumnSpan="3"
Style="{StaticResource DefaultText}"
/>
</Border>
<Border Grid.Row="1" x:Name="borderLogonActive"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5"
Grid.ColumnSpan="3"
>
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.Header}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.AutoPassthroughOff}"
Grid.Row="1"
Grid.Column="1"
Margin="8 0 0 0"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.LogonDisabled}"
Grid.Row="2"
Grid.Column="1"
Margin="8 0 0 0"
Style="{StaticResource DefaultText}"
/>
<CheckBox x:Name="DisablePassthroughCheckBox"
Style="{DynamicResource ToggleSwitch}"
HorizontalAlignment="Left"
Grid.Row="1"
Grid.Column="0"
Margin="0,6,0,7"
IsChecked="{Binding Path=(local:cAuthenticationSettingsController.noPassthrough)}"
/>
<CheckBox x:Name="DisableLogonCheckBox"
Style="{DynamicResource ToggleSwitch}"
HorizontalAlignment="Left"
Grid.Row="2"
Grid.Column="0"
Margin="0,6,0,7"
IsChecked="{Binding Path=noLogonAtAll}"
/>
</Grid>
</Border>
<Border Grid.Row="2" x:Name="borderLogonMethod"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5"
Grid.ColumnSpan="3"
Visibility="{Binding Path=visibilityLogonMethod, Converter={StaticResource VisibilityConverter}}"
>
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.AuthenticationMethod}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
FontWeight="Bold"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.None}"
Grid.Row="1"
Grid.Column="1"
Margin="8 0 0 0"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic}"
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource DefaultText}" HorizontalAlignment="Right" Width="519"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token}"
Grid.Row="3"
Grid.Column="1"
Margin="8 0 0 0"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.WebForm}"
Grid.Row="4"
Grid.Column="1"
Margin="8 0 0 0"
Style="{StaticResource DefaultText}"
/>
<RadioButton x:Name="radioButtonLogonMethodNone"
Style="{DynamicResource RadioButtonStyle}"
HorizontalAlignment="Left"
Grid.Row="1"
Grid.Column="0"
Margin="4 5"
IsChecked="{Binding Path=(local:cAuthenticationSettingsController.additionalMethod), Converter={StaticResource EnumerationComparisonConverter}, ConverterParameter={x:Static cfgHlp:enumAlternateAuthMethods.none}}"
/>
<RadioButton x:Name="radioButtonLogonMethodBasic"
Style="{DynamicResource RadioButtonStyle}"
HorizontalAlignment="Left"
Grid.Row="2"
Grid.Column="0"
Margin="4 5"
IsChecked="{Binding Path=(local:cAuthenticationSettingsController.additionalMethod), Converter={StaticResource EnumerationComparisonConverter}, ConverterParameter={x:Static cfgHlp:enumAlternateAuthMethods.authCredentials}}"
/>
<RadioButton x:Name="radioButtonLogonMethodToken"
Style="{DynamicResource RadioButtonStyle}"
HorizontalAlignment="Left"
Grid.Row="3"
Grid.Column="0"
Margin="4 5"
IsChecked="{Binding Path=(local:cAuthenticationSettingsController.additionalMethod), Converter={StaticResource EnumerationComparisonConverter}, ConverterParameter={x:Static cfgHlp:enumAlternateAuthMethods.authToken}}"
/>
<RadioButton x:Name="radioButtonLogonMethodForms"
Style="{DynamicResource RadioButtonStyle}"
HorizontalAlignment="Left"
Grid.Row="4"
Grid.Column="0"
Margin="4 5"
IsChecked="{Binding Path=(local:cAuthenticationSettingsController.additionalMethod), Converter={StaticResource EnumerationComparisonConverter}, ConverterParameter={x:Static cfgHlp:enumAlternateAuthMethods.authForms}}"
/>
</Grid>
</Border>
<Border Grid.Row="3" x:Name="additionalBlockLogonMethodBasic"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5" Grid.ColumnSpan="3"
Visibility="{Binding Path=visibilityAdditionalLogonMethodBasic, Converter={StaticResource VisibilityConverter}}"
>
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Header}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
FontWeight="Bold"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Username}"
Grid.Row="1"
Grid.Column="0"
Margin="4 0 0 0"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Password}"
Grid.Row="2"
Grid.Column="0"
Margin="4 0 0 0"
Style="{StaticResource DefaultText}"
/>
<Border
Grid.Row="1"
Grid.Column="1"
Margin="8 5"
CornerRadius="2"
BorderThickness="0.5"
BorderBrush="Gray"
VerticalAlignment="Center"
Padding="3 2"
>
<TextBox
BorderThickness="0"
BorderBrush="Transparent"
VerticalAlignment="Center"
Text="{Binding Path=txtBasicUser}"
/>
</Border>
<usrc:PasswordInputBox
Grid.Row="2"
Grid.Column="1"
Password="{Binding Path=txtBasicPassword, Mode=TwoWay}"
/>
</Grid>
</Border>
<Border Grid.Row="4" x:Name="additionalBlockLogonMethodToken"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5" Grid.ColumnSpan="3"
Visibility="{Binding Path=visibilityAdditionalLogonMethodToken, Converter={StaticResource VisibilityConverter}, FallbackValue='true'}"
>
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token.Header}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Style="{StaticResource DefaultText}"
/>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token.Token}"
Grid.Row="1"
Grid.Column="0"
Margin="4 0 0 0"
Style="{StaticResource DefaultText}"
/>
<usrc:PasswordInputBox
Grid.Row="1"
Grid.Column="1"
Password="{Binding Path=txtTokenSecret}"
/>
</Grid>
</Border>
<Border Grid.Row="5" x:Name="additionalBlockLogonMethodForms"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
Margin="5,5,5,5"
Padding="10 5" Grid.ColumnSpan="3"
Visibility="{Binding Path=visibilityAdditionalLogonMethodForms, Converter={StaticResource VisibilityConverter}}"
>
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowsHeight" />
<RowDefinition SharedSizeGroup="RowsHeight" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Forms.Header}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Style="{StaticResource DefaultText}"
/>
<Border
Grid.Row="1"
Grid.Column="1"
Margin="8 5"
CornerRadius="2"
BorderThickness="0.5"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Height="21"
Padding="4 2"
MouseLeftButtonDown="DoFormsAuthentication_MouseLeftButtonDown"
KeyUp="DoFormsAuthentication_KeyUp"
TouchUp="DoFormsAuthentication_TouchUp"
>
<Border.Resources>
<Style TargetType="Border">
<Setter Property="Background"
Value="#F2F2F2" />
<Setter Property="BorderBrush"
Value="Gray" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFD8E6FF" />
<Setter Property="BorderBrush" Value="#FF5593FF" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Forms.Logon}"
Grid.Row="2"
Grid.Column="0"
Margin="8 0 8 0"
IsHitTestVisible="False"
Style="{StaticResource DefaultText}"
/>
</Border>
</Grid>
</Border>
<TextBlock Grid.Row="6" x:Name="txtAuthenticationError"
Grid.ColumnSpan="3"
Text="{Binding Path=txtErrorMessage}"
Grid.Column="0"
Margin="10 3 0 3"
Foreground="Red"
Visibility="{Binding Path=visibilityErrorMessage, Converter={StaticResource VisibilityConverter}}"
/>
<Grid Grid.Row="7" Grid.ColumnSpan="3">
<Grid.Resources>
<Style TargetType="ico:AdaptableIcon">
<Setter Property="Margin"
Value="0 10 0 0" />
<Setter Property="IconWidth"
Value="125" />
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon}" />
<Setter Property="BorderPadding"
Value="2.5" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="Cursor"
Value="Hand" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="31*"/>
<ColumnDefinition Width="38*" />
</Grid.ColumnDefinitions>
<ico:AdaptableIcon x:Name="ConfirmButton"
Grid.Column="0"
SelectedMaterialIcon="ic_check" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="32,10,0,0" MouseDown="ConfirmButton_MouseDown" TouchDown="ConfirmButton_TouchDown">
<ico:AdaptableIcon.Tag>
<sys:Boolean>True</sys:Boolean>
</ico:AdaptableIcon.Tag>
<ico:AdaptableIcon.Resources>
<Style TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Green}" />
<Setter Property="IconBackgroundColor"
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
</Trigger>
</Style.Triggers>
</Style>
</ico:AdaptableIcon.Resources>
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="CancelButton"
Grid.Column="2"
SelectedMaterialIcon="ic_close" Margin="0,10,0,0" MouseLeftButtonUp="CloseButton_MouseLeftButtonUp" TouchDown="CloseButton_TouchDown">
<ico:AdaptableIcon.Tag>
<sys:Boolean>False</sys:Boolean>
</ico:AdaptableIcon.Tag>
<ico:AdaptableIcon.Resources>
<Style TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Menu.Icon}" />
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="PrimaryIconColor"
Value="{DynamicResource Color.Red}" />
<Setter Property="IconBackgroundColor"
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
</Trigger>
</Style.Triggers>
</Style>
</ico:AdaptableIcon.Resources>
</ico:AdaptableIcon>
</Grid>
<Border
Style="{StaticResource BlurMaskBoarder}"
Visibility="{Binding Path=visibilityBlurMask, Converter={StaticResource VisibilityConverter}}"
/>
</Grid>
</Grid>
</Border>
</Window>

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using C4IT.AdaptableIcons;
namespace C4IT_CustomerPanel.forms.AuthenticationSettings;
public partial class AuthenticationSettings : Window
{
private CPM42FormsAuthentication FormsAuthentication;
public AuthenticationSettings()
{
InitializeComponent();
if (this.DataContext is cAuthenticationSettingsController controller)
controller.Init(false);
}
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
{
Close();
}
private void CloseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Close();
}
private void iconPasswordShow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
}
private void ConfirmButton_MouseDown(object sender, MouseButtonEventArgs e)
{
ConfirmButton_Click(sender);
}
private void ConfirmButton_TouchDown(object sender, TouchEventArgs e)
{
ConfirmButton_Click(sender);
}
private async void ConfirmButton_Click(object sender)
{
if (this.DataContext is cAuthenticationSettingsController controller)
controller.SaveSettings();
Close();
}
private void DoFormsAuthentication_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
ShowFormBasedAuthentication();
}
private void DoFormsAuthentication_KeyUp(object sender, KeyEventArgs e)
{
ShowFormBasedAuthentication();
}
private void DoFormsAuthentication_TouchUp(object sender, TouchEventArgs e)
{
ShowFormBasedAuthentication();
}
private void ShowFormBasedAuthentication()
{
Cursor = Cursors.Wait;
if (this.DataContext is cAuthenticationSettingsController controller)
controller.FormsAuthenticationStart();
FormsAuthentication = new CPM42FormsAuthentication();
FormsAuthentication.AuthenticationCompleted += FormsAuthenticationFinished;
FormsAuthentication.Show();
}
public async void FormsAuthenticationFinished(object sender, EventArgs e)
{
string _token = null;
if (sender is CPM42FormsAuthentication _formsAuth)
_token = _formsAuth.AccessToken;
if (this.DataContext is cAuthenticationSettingsController controller)
await controller.FormsAuthenticationFinished(_token);
FormsAuthentication = null;
Cursor = null;
}
private void _this_Closed(object sender, EventArgs e)
{
if (FormsAuthentication != null)
FormsAuthentication.Close();
}
}

View File

@@ -0,0 +1,332 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using C4IT.API;
using C4IT.Matrix42.WebClient;
using C4IT_CustomerPanel.libs;
using static C4IT_CustomerPanel.libs.ConfigClass;
namespace C4IT_CustomerPanel.forms.AuthenticationSettings
{
internal class cAuthenticationSettingsController : INotifyPropertyChanged
{
#region dependency properties
#region noPassthrough property
private bool _noPassthrough = default;
public bool noPassthrough
{
get { return _noPassthrough; }
set
{
if (value != _noPassthrough)
{
_noPassthrough = value;
OnPropertyChanged(nameof(noPassthrough));
CheckLogonSettings();
}
}
}
#endregion noPassthrough property
#region noLogonAtAll property
private bool _noLogonAtAll = default;
public bool noLogonAtAll
{
get { return _noLogonAtAll; }
set
{
if (value != _noLogonAtAll)
{
_noLogonAtAll = value;
OnPropertyChanged(nameof(noLogonAtAll));
CheckLogonSettings();
}
}
}
#endregion noLogonAtAll property
#region additionalMethod property
private enumAlternateAuthMethods _additionalMethod = default;
public enumAlternateAuthMethods additionalMethod
{
get { return _additionalMethod; }
set
{
if (value != _additionalMethod)
{
_additionalMethod = value;
OnPropertyChanged(nameof(additionalMethod));
CheckAdditionalMethodsSelection();
}
}
}
#endregion additionalMethod property
#region visibilityLogonMethod property
private bool _visibilityLogonMethod = default;
public bool visibilityLogonMethod
{
get { return _visibilityLogonMethod; }
set
{
if (value != _visibilityLogonMethod)
{
_visibilityLogonMethod = value;
OnPropertyChanged(nameof(visibilityLogonMethod));
CheckLogonSettings();
}
}
}
#endregion visibilityLogonMethod property
#region visibilityAdditionalLogonMethodBasic property
private bool _visibilityAdditionalLogonMethodBasic = default;
public bool visibilityAdditionalLogonMethodBasic
{
get { return _visibilityAdditionalLogonMethodBasic; }
set
{
if (value != _visibilityAdditionalLogonMethodBasic)
{
_visibilityAdditionalLogonMethodBasic = value;
OnPropertyChanged(nameof(visibilityAdditionalLogonMethodBasic));
}
}
}
#endregion visibilityAdditionalLogonMethodBasic property
#region visibilityAdditionalLogonMethodToken property
private bool _visibilityAdditionalLogonMethodToken = default;
public bool visibilityAdditionalLogonMethodToken
{
get { return _visibilityAdditionalLogonMethodToken; }
set
{
if (value != _visibilityAdditionalLogonMethodToken)
{
_visibilityAdditionalLogonMethodToken = value;
OnPropertyChanged(nameof(visibilityAdditionalLogonMethodToken));
}
}
}
#endregion visibilityAdditionalLogonMethodToken property
#region visibilityAdditionalLogonMethodForms property
private bool _visibilityAdditionalLogonMethodForms = default;
public bool visibilityAdditionalLogonMethodForms
{
get { return _visibilityAdditionalLogonMethodForms; }
set
{
if (value != _visibilityAdditionalLogonMethodForms)
{
_visibilityAdditionalLogonMethodForms = value;
OnPropertyChanged(nameof(visibilityAdditionalLogonMethodForms));
}
}
}
#endregion visibilityAdditionalLogonMethodForms property
#region visibilityErrorMessage property
private bool _visibilityErrorMessage = true;
public bool visibilityErrorMessage
{
get { return _visibilityErrorMessage; }
set
{
if (value != _visibilityErrorMessage)
{
_visibilityErrorMessage = value;
OnPropertyChanged(nameof(visibilityBlurMask));
}
}
}
#endregion visibilityErrorMessage property
#region visibilityBlurMask property
private bool _visibilityBlurMask = false;
public bool visibilityBlurMask
{
get { return _visibilityBlurMask; }
set
{
if (value != _visibilityBlurMask)
{
_visibilityBlurMask = value;
OnPropertyChanged(nameof(visibilityBlurMask));
}
}
}
#endregion visibilityBlurMask property
#region txtBasicUser property
private String _txtBasicUser = "imagoverum\\vvogel";
public String txtBasicUser
{
get { return _txtBasicUser; }
set
{
if (value != _txtBasicUser)
{
_txtBasicUser = value;
OnPropertyChanged(nameof(txtBasicUser));
}
}
}
#endregion txtErrorMessage property
#region txtBasicPassword property
private String _txtBasicPassword = "Matrix42";
public String txtBasicPassword
{
get { return _txtBasicPassword; }
set
{
if (value != _txtBasicPassword)
{
_txtBasicPassword = value;
OnPropertyChanged(nameof(txtBasicPassword));
}
}
}
#endregion txtBasicPassword property
#region txtTokenSecret property
private String _txtTokenSecret = "876543210987";
public String txtTokenSecret
{
get { return _txtTokenSecret; }
set
{
if (value != _txtTokenSecret)
{
_txtTokenSecret = value;
OnPropertyChanged(nameof(txtTokenSecret));
}
}
}
#endregion txtTokenSecret property
#region txtErrorMessage property
private String _txtErrorMessage = "You could not be authenticated. Please change your specification to ensure valid authentication.";
public String txtErrorMessage
{
get { return _txtErrorMessage; }
set
{
if (value != _txtErrorMessage)
{
_txtErrorMessage = value;
OnPropertyChanged(nameof(txtErrorMessage));
}
}
}
#endregion txtErrorMessage property
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
#endregion dependency properties
private bool isDesignMode = true;
public cAuthenticationSettingsController()
{
Init();
}
public void Init(bool isDesignMode = true)
{
this.isDesignMode = isDesignMode;
visibilityErrorMessage = isDesignMode;
if (!isDesignMode)
{
var authConfig = ConfigClassV2.Instance.Authentication;
noPassthrough = authConfig.noPassthrough;
noLogonAtAll = authConfig.noLogonAtAll;
additionalMethod = authConfig.additionalMethod;
txtBasicUser = authConfig.BasicUsername;
var strDecodedBasicPassword = PrivateCustomerPanelSecurePassword.Instance.Decode(authConfig.BasicPassword);
txtBasicPassword = strDecodedBasicPassword;
txtTokenSecret = PrivateCustomerPanelSecurePassword.Instance.Decode(authConfig.M42AccessToken);
}
CheckLogonSettings();
CheckAdditionalMethodsSelection();
}
private void CheckLogonSettings()
{
visibilityLogonMethod = !noLogonAtAll || isDesignMode;
CheckAdditionalMethodsSelection();
}
private void CheckAdditionalMethodsSelection()
{
visibilityAdditionalLogonMethodBasic = visibilityLogonMethod && (additionalMethod == enumAlternateAuthMethods.authCredentials) || isDesignMode;
visibilityAdditionalLogonMethodToken = visibilityLogonMethod && (additionalMethod == enumAlternateAuthMethods.authToken) || isDesignMode;
visibilityAdditionalLogonMethodForms = visibilityLogonMethod && (additionalMethod == enumAlternateAuthMethods.authForms) || isDesignMode;
}
public void FormsAuthenticationStart()
{
visibilityBlurMask = true;
}
public async Task FormsAuthenticationFinished(string AccessToken)
{
if (!string.IsNullOrEmpty(AccessToken))
{
var m42WebClient = new cM42WebClientV2(MainWindow.MainInstance.ConfigSettings.GetMatrixServer(false), MainWindow.MainInstance.ConfigSettings.GetCultureName(), DisableDNSCache: true);
m42WebClient.RegisterBearerTokenAuthentication(AccessToken);
var _res = await m42WebClient.LogonAsync();
}
visibilityBlurMask = false;
}
public void SaveSettings()
{
var authConfig = ConfigClassV2.Instance.Authentication;
authConfig.noPassthrough = noPassthrough;
authConfig.noLogonAtAll = noLogonAtAll;
authConfig.additionalMethod = additionalMethod;
authConfig.BasicUsername = txtBasicUser;
var strEncodedBasicPassword = PrivateCustomerPanelSecurePassword.Instance.Encode(txtBasicPassword);
authConfig.BasicPassword = strEncodedBasicPassword;
authConfig.M42AccessToken = PrivateCustomerPanelSecurePassword.Instance.Encode(txtTokenSecret);
ConfigClassV2.Instance.Save(@"Authentication\*");
}
}
}