Init claims

This commit is contained in:
TheJoKlLa 2024-03-27 19:48:47 +01:00
parent dbf19566db
commit 296c0a29ee
3 changed files with 23 additions and 13 deletions

2
.gitmodules vendored
View File

@ -6,4 +6,4 @@
url = https://github.com/kjkriegel/S22.Sasl.git url = https://github.com/kjkriegel/S22.Sasl.git
[submodule "FabAccessAPI/schema"] [submodule "FabAccessAPI/schema"]
path = FabAccessAPI/schema path = FabAccessAPI/schema
url = https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git url = ../fabaccess-api.git

View File

@ -447,7 +447,7 @@ namespace FabAccessAPI
Response? response = await authentication.Step(data); Response? response = await authentication.Step(data);
while (!saslMechanism.IsCompleted) while (!saslMechanism.IsCompleted)
{ {
if (response.Failed != null) if (response != null)
{ {
break; break;
} }
@ -466,18 +466,19 @@ namespace FabAccessAPI
{ {
return response.Successful.Session; 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(); throw new BadMechanismException();
case Response.Error.invalidCredentials: case Response.Reason.invalidCredentials:
throw new InvalidCredentialsException(); throw new InvalidCredentialsException();
case Response.Error.aborted: case Response.Reason.aborted:
case Response.Error.failed: case Response.Reason.failed:
default: default:
throw new AuthenticationFailedException(response.Failed.AdditionalData.ToArray()); throw new AuthenticationFailedException();
// TODO throw new AuthenticationFailedException(response.Error.AdditionalData.ToArray());
} }
} }
else else
@ -491,12 +492,17 @@ namespace FabAccessAPI
/// </summary> /// </summary>
private async Task<ServerData> _GetServerData(IBootstrap bootstrap) private async Task<ServerData> _GetServerData(IBootstrap bootstrap)
{ {
var release = await bootstrap.GetServerRelease().ConfigureAwait(false);
var info = await bootstrap.GetServerInfo().ConfigureAwait(false);
ServerData serverData = new ServerData() ServerData serverData = new ServerData()
{ {
APIVersion = await bootstrap.GetAPIVersion().ConfigureAwait(false), APIVersion = await bootstrap.GetAPIVersion().ConfigureAwait(false),
Mechanisms = new List<string>(await bootstrap.Mechanisms().ConfigureAwait(false)), Mechanisms = new List<Mechanism>(await bootstrap.Mechanisms().ConfigureAwait(false)),
ServerName = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item1, ServerName = release.Item1,
ServerRelease = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item2, ServerRelease = release.Item2,
SpaceName = info.Item1,
InstanceURL = info.Item2
}; };
return serverData; return serverData;

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using FabAccessAPI.Schema;
namespace FabAccessAPI namespace FabAccessAPI
{ {
@ -8,6 +9,9 @@ namespace FabAccessAPI
public Schema.Version APIVersion; public Schema.Version APIVersion;
public string ServerName; public string ServerName;
public string ServerRelease; public string ServerRelease;
public List<string> Mechanisms; public string SpaceName;
public string InstanceURL;
public List<Mechanism> Mechanisms;
} }
} }