Merge branch 'New_API' into 'alpha'

Simple State of Client to start with new API

See merge request fabinfra/fabaccess/borepin!18
This commit is contained in:
TheJoKlLa 2021-09-21 22:51:10 +00:00
commit 651aa0e5f7
35 changed files with 364 additions and 134 deletions

View File

@ -2,6 +2,7 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using AndroidX.AppCompat.App;
namespace Borepin.Droid
{
@ -10,6 +11,8 @@ namespace Borepin.Droid
{
protected override void OnCreate(Bundle savedInstanceState)
{
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

View File

@ -2,6 +2,5 @@
x:Class="Borepin.UWP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Borepin.UWP">
xmlns:local="using:Borepin.UWP" RequestedTheme="Light">
</Application>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -193,4 +193,8 @@
<ItemGroup>
<Folder Include="Assets.xcassets\LaunchIcon.imageset\" />
</ItemGroup>
<Target Name="BeforeBuild" Condition=" '$(GITLAB_CI)' == 'true' ">
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" Value="$(CI_PIPELINE_ID)" />
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]" Value="0.1.0" />
</Target>
</Project>

View File

@ -40,5 +40,7 @@
<false/>
<key>NFCReaderUsageDescription</key>
<string>FabAccess needs to be able to read your card for authentication with the server.</string>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict>
</plist>

View File

@ -45,6 +45,7 @@ namespace Borepin
containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>();
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");

View File

@ -68,6 +68,9 @@
<EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\ListPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
@ -98,6 +101,9 @@
<EmbeddedResource Update="Page\StartUpDistributorPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\TestPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -109,6 +115,12 @@
<EmbeddedResource Update="Styles\LightTheme.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\IsBusyView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ListItemView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ScanView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>

View File

@ -29,12 +29,12 @@ namespace Borepin.Model
State = _Machine.State;
Manager = new UserVisualize(_Machine.Manager);
CanUse = _Machine.Use != null;
CanInUse = _Machine.Inuse != null;
CanTransfer = _Machine.Transfer != null;
CanCheck = _Machine.Check != null;
CanManage = _Machine.Manage != null;
CanAdmin = _Machine.Admin != null;
CanUse = !((UseInterface_Proxy)_Machine.Use).IsNull;
CanInUse = !((InUseInterface_Proxy) _Machine.Inuse).IsNull;
CanTransfer = !((TransferInterface_Proxy) _Machine.Transfer).IsNull;
CanCheck = !((CheckInterface_Proxy) _Machine.Check).IsNull;
CanManage = !((ManageInterface_Proxy) _Machine.Manage).IsNull;
CanAdmin = !((AdminInterface_Proxy) _Machine.Admin).IsNull;
}
#endregion

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Borepin.View"
x:Class="Borepin.Page.ListPage">
<ContentPage.Content>
<StackLayout>
<ListView ItemsSource="{Binding ListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListPage : ContentPage
{
public ListPage()
{
InitializeComponent();
}
}
}

View File

@ -3,26 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.SetUpProcess.ScanPage"
xmlns:i18n="clr-namespace:Borepin.Helpers"
xmlns:views="clr-namespace:Borepin.View"
xmlns:converters="clr-namespace:Borepin.Converter">
<NavigationPage.TitleView>
<Label Text="FabAccess" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
xmlns:views="clr-namespace:Borepin.View">
<ContentPage.Content>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<ScrollView>
<StackLayout Style="{StaticResource Style_StackLayout_Content}">
<views:ScanView />
<Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/>
<Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.TestPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="TestPage"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
}
}
}

View File

@ -31,12 +31,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion
#region LoadData
public override async Task LoadData()
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
}
#endregion
@ -125,8 +124,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -16,12 +16,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion
#region LoadData
public override async Task LoadData()
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
}
#endregion
@ -51,8 +50,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
IsBusy = false;
}
#endregion
}

View File

@ -4,6 +4,7 @@ using Borepin.Service.BFFH;
using Borepin.Service.Connections;
using Prism.Commands;
using Prism.Navigation;
using Prism.Services;
using System;
using System.Threading.Tasks;
using System.Windows.Input;
@ -15,13 +16,16 @@ namespace Borepin.PageModel.AddServerProcess
#region Private Properties
private readonly IBFFHService _BFFHService;
private readonly IConnectionService _ConnectionService;
private readonly IPageDialogService _PageDialogService;
#endregion
#region Constructors
public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService) : base(navigationService)
public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService, IPageDialogService pageDialogService) : base(navigationService)
{
_BFFHService = bffhService;
_ConnectionService = connectionService;
_PageDialogService = pageDialogService;
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecuted());
@ -30,12 +34,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion
#region LoadData
public override async Task LoadData()
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
}
#endregion
@ -65,11 +68,19 @@ namespace Borepin.PageModel.AddServerProcess
private async Task AuthenticateCommandExecuted()
{
IsBusy = true;
Connection connection_update = _BFFHService.ActiveConnection;
connection_update.Username = Username;
await _BFFHService.Authenticate(connection_update, Password).ConfigureAwait(false);
if(!await _BFFHService.Authenticate(connection_update, Password))
{
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok");
IsBusy = false;
return;
}
try
{
@ -77,7 +88,7 @@ namespace Borepin.PageModel.AddServerProcess
}
catch (ArgumentException)
{
// Could be better catched
}
await _ConnectionService.LogConnect(_BFFHService.ActiveConnection);
@ -99,8 +110,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -0,0 +1,57 @@
using Borepin.Model;
using Borepin.ViewModel;
using Prism.Mvvm;
using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class ListPageModel : BindableBase
{
public ListPageModel()
{
ListItemViewModel_List = new List<ListItemViewModel>()
{
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 1"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 2"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 3"
}),
};
SelectListItemCommand = new Command<object>(SelectListItemCommandExecuted);
}
private List<ListItemViewModel> _ListItemViewModel_List;
public List<ListItemViewModel> ListItemViewModel_List
{
get => _ListItemViewModel_List;
set => SetProperty(ref _ListItemViewModel_List, value);
}
private ICommand _SelectListItemCommand;
public ICommand SelectListItemCommand
{
get => _SelectListItemCommand;
set => SetProperty(ref _SelectListItemCommand, value);
}
private void SelectListItemCommandExecuted(object obj)
{
System.Diagnostics.Debugger.Break();
}
}
}

View File

@ -25,11 +25,9 @@ namespace Borepin.PageModel
}
#endregion
#region LoadData
#region Data
public override async Task LoadData()
{
IsBusy = true;
if (_BFFHService.ActiveConnection == null)
{
IsBusy = false;

View File

@ -28,7 +28,7 @@ namespace Borepin.PageModel
}
#endregion
#region LoadData
#region Data
public override async Task LoadData()
{
IsBusy = true;

View File

@ -1,31 +1,20 @@
using Borepin.Base;
using Prism.Mvvm;
using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class MainPagePageModel : PageModelBase
public class MainPagePageModel : BindableBase
{
#region Constructors
public MainPagePageModel(INavigationService navigationService) : base(navigationService)
private INavigationService _NavigationService;
public MainPagePageModel(INavigationService navigationService)
{
_NavigationService = navigationService;
NavigateCommand = new Command<string>(NavigateCommandExecuted);
}
#endregion
#region LoadData
public override async Task LoadData()
{
IsBusy = true;
IsBusy = false;
await LoadData();
}
#endregion
#region Commands
private ICommand _NavigationCommand;
public ICommand NavigateCommand
@ -42,19 +31,5 @@ namespace Borepin.PageModel
System.Diagnostics.Debugger.Break();
}
}
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}
}

View File

@ -31,11 +31,9 @@ namespace Borepin.PageModel
}
#endregion
#region LoadData
#region Data
public override async Task LoadData()
{
IsBusy = true;
List<Connection> list = await _ConnectionService.GetConnectionList();
if (_BFFHService.ActiveConnection != null)
{

View File

@ -37,13 +37,10 @@ namespace Borepin.PageModel
}
#endregion
#region LoadData
public override async Task LoadData()
#region Data
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await LoadData();
throw new System.NotImplementedException();
}
#endregion
@ -94,7 +91,14 @@ namespace Borepin.PageModel
IsBusy = false;
return;
}
await _BFFHService.Authenticate();
if(!await _BFFHService.Authenticate())
{
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok");
IsBusy = false;
return;
}
IsConnected = true;
}
@ -169,8 +173,7 @@ namespace Borepin.PageModel
IsConnected = false;
}
IsBusy = true;
Task.Run(LoadData);
IsBusy = false;
}
#endregion
}

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
}
#endregion
#region LoadData
public override async Task LoadData()
#region Data
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
}
#endregion
@ -50,8 +47,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
}
#endregion
#region LoadData
public override async Task LoadData()
#region Data
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
}
#endregion
@ -34,7 +31,8 @@ namespace Borepin.PageModel.SetUpProcess
}
private async void NextCommandCommandExecuted(object obj)
{
INavigationResult result = await _NavigationService.NavigateAsync("SetUpProcess_ScanPage");
//INavigationResult result = await _NavigationService.NavigateAsync("SetUpProcess_ScanPage");
INavigationResult result = await _NavigationService.NavigateAsync("AddServerProcess_HostSelectPage");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();
@ -50,8 +48,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -27,12 +27,9 @@ namespace Borepin.PageModel
#endregion
#region LoadData
public override async Task LoadData()
public override Task LoadData()
{
IsBusy = true;
IsBusy = false;
await LoadData();
return Task.CompletedTask;
}
#endregion
@ -78,8 +75,7 @@ namespace Borepin.PageModel
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -0,0 +1,39 @@
using Borepin.Base;
using Prism.Navigation;
using System.Threading.Tasks;
namespace Borepin.PageModel
{
class TestPageModel : PageModelBase
{
#region Contructors
public TestPageModel(INavigationService navigationService) : base(navigationService)
{
}
#endregion
#region Data
public override Task LoadData()
{
Task.Delay(3000);
IsBusy = false;
return Task.CompletedTask;
}
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}
}

View File

@ -79,7 +79,7 @@ namespace Borepin.Resources.Text {
}
/// <summary>
/// Looks up a localized string similar to Start working.
/// Looks up a localized string similar to Begin working.
/// </summary>
internal static string SetUp_WelcomePage_Button {
get {
@ -88,7 +88,7 @@ namespace Borepin.Resources.Text {
}
/// <summary>
/// Looks up a localized string similar to Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann.
/// Looks up a localized string similar to Automate your Space with FabAccess.
/// </summary>
internal static string SetUp_WelcomePage_Text {
get {

View File

@ -124,10 +124,10 @@
<value>Wenn du dieses Logo siehst, dann kannst du es scannen</value>
</data>
<data name="SetUp_WelcomePage_Button" xml:space="preserve">
<value>Start working</value>
<value>Begin working</value>
</data>
<data name="SetUp_WelcomePage_Text" xml:space="preserve">
<value>Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</value>
<value>Automate your Space with FabAccess</value>
</data>
<data name="SetUp_WelcomePage_Title" xml:space="preserve">
<value>Welcome</value>

View File

@ -75,20 +75,21 @@ namespace Borepin.Service.BFFH
{
string password = await _CredentialService.GetPasswordAsync(ActiveConnection);
await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } });
return await Task.FromResult(true);
return await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } });
}
public async Task<bool> Authenticate(Connection connection, string password)
{
await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } }).ConfigureAwait(false);
bool result = await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } });
if(result == true)
{
await _CredentialService.AddCredentialsAsync(connection, password);
ActiveConnection = connection;
}
return await Task.FromResult(true);
return result;
}
public Task<IMachineSystem> GetMachineSystemInterface()

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.IsBusyView">
<ContentView.Content>
<StackLayout>
<Label Text="IsBusy" />
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class IsBusyView : ContentView
{
public IsBusyView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.ListItemView"
xmlns:pagemodel="clr-namespace:Borepin.PageModel">
<ContentView.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="{Binding Value}" />
<Button Text="X" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ListPageModel}}, Path=SelectListItemCommand}" CommandParameter="{Binding .}" />
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListItemView : ContentView
{
public ListItemView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,20 @@
using Borepin.Model;
using Prism.Mvvm;
namespace Borepin.ViewModel
{
public class ListItemViewModel : BindableBase
{
public ListItemViewModel(ListItem listItem)
{
Value = listItem.Value1;
}
private string _Value;
public string Value
{
get => _Value;
set => SetProperty(ref _Value, value);
}
}
}

View File

@ -124,7 +124,6 @@ namespace FabAccessAPI
public async Task<bool> Authenticate(string mech, Dictionary<string, object> properties)
{
var m = SaslFactory.Create(mech);
foreach (KeyValuePair<string, object> entry in properties)
{

View File

@ -40,11 +40,15 @@ namespace FabAccessAPI
/// <param name="mech">The desired authentication mechanism</param>
/// <param name="kvs">Key-Value data specific to the mechanism</param>
/// <returns></returns>
public async Task Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default)
public async Task<bool> Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default)
{
// _bootstrapCap = await _bootstrapCap.Unwrap();
var authCap = await _bootstrapCap.AuthenticationSystem(cancellationToken_).ConfigureAwait(false);
if(_auth == null)
{
var authCap = await _bootstrapCap.AuthenticationSystem(cancellationToken_);
_auth = new Auth(authCap);
}
var mechs = await _auth.GetMechanisms();
//_Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}");
@ -53,7 +57,7 @@ namespace FabAccessAPI
throw new UnsupportedMechanismException();
}
await _auth.Authenticate(mech, kvs);
return await _auth.Authenticate(mech, kvs);
}
/// <summary>