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
[submodule "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);
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
/// </summary>
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()
{
APIVersion = await bootstrap.GetAPIVersion().ConfigureAwait(false),
Mechanisms = new List<string>(await bootstrap.Mechanisms().ConfigureAwait(false)),
ServerName = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item1,
ServerRelease = (await bootstrap.GetServerRelease().ConfigureAwait(false)).Item2,
Mechanisms = new List<Mechanism>(await bootstrap.Mechanisms().ConfigureAwait(false)),
ServerName = release.Item1,
ServerRelease = release.Item2,
SpaceName = info.Item1,
InstanceURL = info.Item2
};
return serverData;

View File

@ -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<string> Mechanisms;
public string SpaceName;
public string InstanceURL;
public List<Mechanism> Mechanisms;
}
}