diff --git a/FabAccessAPI/Auth.cs b/FabAccessAPI/Auth.cs
index 9f68def..7ac5096 100644
--- a/FabAccessAPI/Auth.cs
+++ b/FabAccessAPI/Auth.cs
@@ -1,18 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Capnp;
-using Capnp.Rpc;
+using Capnp;
using FabAccessAPI.Schema;
using S22.Sasl;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Exception = System.Exception;
-namespace FabAccessAPI
-{
+namespace FabAccessAPI {
/// Authentication Identity
///
/// Under the hood a string because the form depends heavily on the method
@@ -49,7 +45,7 @@ namespace FabAccessAPI
/// This struct contains the user as is passed to the actual authentication/authorization
/// subsystems
///
- public struct User {
+ public struct AuthUser {
/// Contains the Authentication ID used
///
/// The authentication ID is an identifier for the authentication exchange. This is different
@@ -101,6 +97,11 @@ namespace FabAccessAPI
}
+ class UnauthorizedException : Exception{}
+
+ ///
+ /// THIS IS VERY INCOMPLETE!
+ ///
class Auth {
private IAuthentication _authCap;
public Auth(IAuthentication authCap) {
@@ -111,7 +112,7 @@ namespace FabAccessAPI
return _authCap.Mechanisms();
}
- public async Task Handshake() {
+ public bool Handshake(Stream stream) {
var host = "localhost";
var asm = typeof(Api).Assembly;
var program = $"{asm.FullName}-{asm.GetName().Version}";
@@ -125,7 +126,7 @@ namespace FabAccessAPI
};
var msg = MessageBuilder.Create();
- var root = msg.BuildRoot();
+ var root = msg.BuildRoot();
message.serialize(root);
var pump = new FramePump(stream);
@@ -141,9 +142,14 @@ namespace FabAccessAPI
Console.WriteLine($"Server: {serverInfo.Host}");
Console.WriteLine($"Version: {serverInfo.Program}");
Console.WriteLine($"API-Version: {serverInfo.Major}.{serverInfo.Minor}");
+
+ //TODO: Check if we are actually compatible. This will probably need some internal lookup or well defined versioning semantics
+ return true;
}
- public async Task