diff --git a/Libraries/Esiur/Esiur.csproj b/Libraries/Esiur/Esiur.csproj
index cdefb72..377ad70 100644
--- a/Libraries/Esiur/Esiur.csproj
+++ b/Libraries/Esiur/Esiur.csproj
@@ -70,6 +70,7 @@
+
@@ -90,6 +91,7 @@
+
diff --git a/Libraries/Esiur/Protocol/EpConnection.cs b/Libraries/Esiur/Protocol/EpConnection.cs
index 1f77594..7790156 100644
--- a/Libraries/Esiur/Protocol/EpConnection.cs
+++ b/Libraries/Esiur/Protocol/EpConnection.cs
@@ -934,7 +934,8 @@ public partial class EpConnection : NetworkConnection, IStore
_openReply = null;
OnReady?.Invoke(this);
- Server?.Membership?.Login(_session);
+ _session.AuthenticationHandler?.Provider?.Login(_session);
+ //Server?.Membership?.Login(_session);
LoginDate = DateTime.Now;
}).Error(x =>
@@ -952,7 +953,9 @@ public partial class EpConnection : NetworkConnection, IStore
_openReply?.Trigger(true);
_openReply = null;
OnReady?.Invoke(this);
- Server?.Membership?.Login(_session);
+
+ _session.AuthenticationHandler?.Provider?.Login(_session);
+ //Server?.Membership?.Login(_session);
}
}
//private void ProcessClientAuth(byte[] data)
@@ -1975,7 +1978,10 @@ public partial class EpConnection : NetworkConnection, IStore
Instance?.Warehouse?.Remove(this);
if (_authenticated)
- Server.Membership?.Logout(_session);
+ {
+ _session.AuthenticationHandler?.Provider.Logout(_session);
+ //Server.Membership?.Logout(_session);
+ }
}
else if (AutoReconnect && !_invalidCredentials)
diff --git a/Libraries/Esiur/Protocol/EpServer.cs b/Libraries/Esiur/Protocol/EpServer.cs
index e828ca3..9fe12de 100644
--- a/Libraries/Esiur/Protocol/EpServer.cs
+++ b/Libraries/Esiur/Protocol/EpServer.cs
@@ -53,23 +53,26 @@ public class EpServer : NetworkServer, IResource
set;
}
- IMembership membership;
+ //IMembership membership;
- [Attribute]
- public IMembership Membership
- {
- get => membership;
- set
- {
- //if (membership != null)
- // membership.Authorization -= Membership_Authorization;
+ //[Attribute]
+ //public IMembership Membership
+ //{
+ // get => membership;
+ // set
+ // {
+ // //if (membership != null)
+ // // membership.Authorization -= Membership_Authorization;
- membership = value;
+ // membership = value;
- //if (membership != null)
- // membership.Authorization += Membership_Authorization;
- }
- }
+ // //if (membership != null)
+ // // membership.Authorization += Membership_Authorization;
+ // }
+ //}
+
+ //[Attribute]
+ //public string MembershipProvider { get; set; }
//private void Membership_Authorization(AuthorizationIndication indication)
//{
diff --git a/Libraries/Esiur/Security/Authority/IAuthenticationHandler.cs b/Libraries/Esiur/Security/Authority/IAuthenticationHandler.cs
index 72684b5..7f56511 100644
--- a/Libraries/Esiur/Security/Authority/IAuthenticationHandler.cs
+++ b/Libraries/Esiur/Security/Authority/IAuthenticationHandler.cs
@@ -8,6 +8,7 @@ namespace Esiur.Security.Authority
public interface IAuthenticationHandler
{
+ IAuthenticationProvider Provider { get; }
public string Protocol { get; }
//public AuthenticationMode Mode { get; }
//public AuthenticationResult Initialize(object authData);
diff --git a/Libraries/Esiur/Security/Authority/IAuthenticationProvider.cs b/Libraries/Esiur/Security/Authority/IAuthenticationProvider.cs
index 778ecd0..5b41f0d 100644
--- a/Libraries/Esiur/Security/Authority/IAuthenticationProvider.cs
+++ b/Libraries/Esiur/Security/Authority/IAuthenticationProvider.cs
@@ -1,4 +1,5 @@
-using System;
+using Esiur.Core;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -10,5 +11,9 @@ namespace Esiur.Security.Authority
CreateAuthenticationHandler(AuthenticationContext context);
public string DefaultName { get; }
+
+ AsyncReply Login(Session session);
+ AsyncReply Logout(Session session);
+
}
}
diff --git a/Libraries/Esiur/Security/Authority/PpapAuthenticationProvider.cs b/Libraries/Esiur/Security/Authority/PpapAuthenticationProvider.cs
index e15d307..1fc72f7 100644
--- a/Libraries/Esiur/Security/Authority/PpapAuthenticationProvider.cs
+++ b/Libraries/Esiur/Security/Authority/PpapAuthenticationProvider.cs
@@ -1,4 +1,5 @@
-using System;
+using Esiur.Core;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -12,5 +13,15 @@ namespace Esiur.Security.Authority
{
throw new NotImplementedException();
}
+
+ public AsyncReply Login(Session session)
+ {
+ throw new NotImplementedException();
+ }
+
+ public AsyncReply Logout(Session session)
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/Libraries/Esiur/Security/Authority/Providers/PasswordAuthenticationHandler.cs b/Libraries/Esiur/Security/Authority/Providers/PasswordAuthenticationHandler.cs
index 498c6ff..1b834d8 100644
--- a/Libraries/Esiur/Security/Authority/Providers/PasswordAuthenticationHandler.cs
+++ b/Libraries/Esiur/Security/Authority/Providers/PasswordAuthenticationHandler.cs
@@ -13,21 +13,24 @@ namespace Esiur.Security.Authority.Providers
{
public string Protocol => "hash";
- byte[] localNonce, remoteNonce;
- byte[] localSalt, remoteSalt;
- string initiatorIdentity, responderIdentity;
+ byte[] _localNonce, _remoteNonce;
+ byte[] _localSalt, _remoteSalt;
- byte[] initiatorPassword, responderPassword;
+ string _initiatorIdentity, _responderIdentity;
- string hostName, domain;
+ byte[] _initiatorPassword, _responderPassword;
- int step = 0;
+ string _hostName, _domain;
- AuthenticationMode mode;
- AuthenticationDirection direction;
+ int _step = 0;
- PasswordAuthenticationProvider provider;
+ AuthenticationMode _mode;
+ AuthenticationDirection _direction;
+
+ PasswordAuthenticationProvider _provider;
+
+ public IAuthenticationProvider Provider => _provider;
public byte[] ComputeSha3(byte[] data, int bitLength = 256)
@@ -50,156 +53,156 @@ namespace Esiur.Security.Authority.Providers
var remoteAuthData = (object[])authData;
var localAuthData = new List