From 296c0a29ee24c289155f7a7e615210b6200a98fb Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Wed, 27 Mar 2024 19:48:47 +0100 Subject: [PATCH] Init claims --- .gitmodules | 2 +- FabAccessAPI/API.cs | 28 +++++++++++++++++----------- FabAccessAPI/ServerData.cs | 6 +++++- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.gitmodules b/.gitmodules index 49f8f88..b608160 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = https://github.com/kjkriegel/S22.Sasl.git [submodule "FabAccessAPI/schema"] path = FabAccessAPI/schema - url = https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git + url = ../fabaccess-api.git diff --git a/FabAccessAPI/API.cs b/FabAccessAPI/API.cs index 63b15a5..9638b68 100644 --- a/FabAccessAPI/API.cs +++ b/FabAccessAPI/API.cs @@ -447,7 +447,7 @@ namespace FabAccessAPI Response? response = await authentication.Step(data); while (!saslMechanism.IsCompleted) { - if (response.Failed != null) + if (response != null) { break; } @@ -466,18 +466,19 @@ namespace FabAccessAPI { return response.Successful.Session; } - else if (response.Failed != null) + else if (response.Error != null) { - switch (response.Failed.Code) + switch (response.Error.Reason) { - case Response.Error.badMechanism: + case Response.Reason.badMechanism: throw new BadMechanismException(); - case Response.Error.invalidCredentials: + case Response.Reason.invalidCredentials: throw new InvalidCredentialsException(); - case Response.Error.aborted: - case Response.Error.failed: + case Response.Reason.aborted: + case Response.Reason.failed: default: - throw new AuthenticationFailedException(response.Failed.AdditionalData.ToArray()); + throw new AuthenticationFailedException(); + // TODO throw new AuthenticationFailedException(response.Error.AdditionalData.ToArray()); } } else @@ -491,12 +492,17 @@ namespace FabAccessAPI /// private async Task _GetServerData(IBootstrap bootstrap) { + var release = await bootstrap.GetServerRelease().ConfigureAwait(false); + var info = await bootstrap.GetServerInfo().ConfigureAwait(false); + ServerData serverData = new ServerData() { APIVersion = await bootstrap.GetAPIVersion().ConfigureAwait(false), - Mechanisms = new List(await bootstrap.Mechanisms().ConfigureAwait(false)), - ServerName = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item1, - ServerRelease = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item2, + Mechanisms = new List(await bootstrap.Mechanisms().ConfigureAwait(false)), + ServerName = release.Item1, + ServerRelease = release.Item2, + SpaceName = info.Item1, + InstanceURL = info.Item2 }; return serverData; diff --git a/FabAccessAPI/ServerData.cs b/FabAccessAPI/ServerData.cs index 9601820..0abd6cb 100644 --- a/FabAccessAPI/ServerData.cs +++ b/FabAccessAPI/ServerData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using FabAccessAPI.Schema; namespace FabAccessAPI { @@ -8,6 +9,9 @@ namespace FabAccessAPI public Schema.Version APIVersion; public string ServerName; public string ServerRelease; - public List Mechanisms; + public string SpaceName; + + public string InstanceURL; + public List Mechanisms; } }