mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-29 06:48:41 +00:00
Auth
This commit is contained in:
@@ -664,9 +664,6 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//@TODO: get the authentication handler
|
//@TODO: get the authentication handler
|
||||||
if (session.RemoteHeaders.ContainsKey(EpAuthPacketHeader.AuthenticationData))
|
if (session.RemoteHeaders.ContainsKey(EpAuthPacketHeader.AuthenticationData))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ using Esiur.Security.Membership;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esiur.Data.Types;
|
using Esiur.Data.Types;
|
||||||
using Esiur.Net;
|
using Esiur.Net;
|
||||||
|
using Esiur.Security.Authority;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
|
||||||
namespace Esiur.Protocol;
|
namespace Esiur.Protocol;
|
||||||
|
|
||||||
public class EpServer : NetworkServer<EpConnection>, IResource
|
public class EpServer : NetworkServer<EpConnection>, IResource
|
||||||
@@ -100,6 +102,12 @@ public class EpServer : NetworkServer<EpConnection>, IResource
|
|||||||
| ExceptionLevel.Trace;
|
| ExceptionLevel.Trace;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void RegisterAuthenticationHandler<T>(string[] domains, AuthenticationMode[] modes) where T : class, IAuthenticationHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Instance Instance
|
public Instance Instance
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Esiur.Security.Authority
|
||||||
|
{
|
||||||
|
public class AuthenticationContext
|
||||||
|
{
|
||||||
|
public AuthenticationMode Mode { get; }
|
||||||
|
|
||||||
|
public string? LocalDomain { get; }
|
||||||
|
public string? RemoteDomain { get; }
|
||||||
|
|
||||||
|
public string? LocalHost { get; }
|
||||||
|
public string? RemoteHost { get; }
|
||||||
|
|
||||||
|
//public AuthenticationComponentContext LocalToRemote { get; } = new();
|
||||||
|
//public AuthenticationComponentContext RemoteToLocal { get; } = new();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Esiur.Security.Authority
|
||||||
|
{
|
||||||
|
public enum AuthenticationProtocol
|
||||||
|
{
|
||||||
|
Hash = 0,
|
||||||
|
PPAP = 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
//using System;
|
||||||
|
//using System.Collections.Generic;
|
||||||
|
//using System.Text;
|
||||||
|
|
||||||
|
//namespace Esiur.Security.Authority
|
||||||
|
//{
|
||||||
|
// public interface IAuthenticationMethodProvider
|
||||||
|
// {
|
||||||
|
// string Method { get; }
|
||||||
|
|
||||||
|
// bool CanHandle(AuthenticationCreationContext context);
|
||||||
|
|
||||||
|
// IAuthenticator CreateAuthenticator(AuthenticationCreationContext context);
|
||||||
|
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Esiur.Security.Authority
|
||||||
|
{
|
||||||
|
public sealed class InitiatorAuthenticationContext
|
||||||
|
{
|
||||||
|
public string LocalIdentity { get; } = string.Empty;
|
||||||
|
public string RemoteIdentity { get; } = string.Empty;
|
||||||
|
|
||||||
|
public string? RemoteDomain { get; }
|
||||||
|
public string? LocalDomain { get; }
|
||||||
|
|
||||||
|
public string? RemoteIpAddress { get; }
|
||||||
|
|
||||||
|
public AuthenticationMode Mode { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Esiur.Security.Authority
|
||||||
|
{
|
||||||
|
public sealed class ResponderAuthenticationContext
|
||||||
|
{
|
||||||
|
public string? RemoteIpAddress { get; }
|
||||||
|
|
||||||
|
public string? LocalDomain { get; }
|
||||||
|
|
||||||
|
public AuthenticationMode Mode { get; }
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<string, string> Headers { get; }
|
||||||
|
= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,8 @@ namespace Esiur.Security.Membership;
|
|||||||
|
|
||||||
public interface IMembership
|
public interface IMembership
|
||||||
{
|
{
|
||||||
|
public IAuthenticationHandler GetAuthenticationHandler(string domain);
|
||||||
|
|
||||||
public event ResourceEventHandler<AuthorizationIndication> Authorization;
|
public event ResourceEventHandler<AuthorizationIndication> Authorization;
|
||||||
|
|
||||||
AsyncReply<string> UserExists(string username, string domain);
|
AsyncReply<string> UserExists(string username, string domain);
|
||||||
|
|||||||
Reference in New Issue
Block a user