mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-03-31 10:28:21 +00:00
renaming 2
This commit is contained in:
@@ -27,7 +27,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Esiur.Net.Packets.IIPAuthPacket;
|
||||
|
||||
namespace Esiur.Security.Authority;
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public class Session
|
||||
public ISymetricCipher SymetricCipher { get; set; } = null;
|
||||
|
||||
|
||||
public Map<IIPAuthPacketHeader, object> LocalHeaders { get; set; } = new Map<IIPAuthPacketHeader, object>();
|
||||
public Map<IIPAuthPacketHeader, object> RemoteHeaders { get; set; } = new Map<IIPAuthPacketHeader, object>();
|
||||
public Map<EpAuthPacketHeader, object> LocalHeaders { get; set; } = new Map<EpAuthPacketHeader, object>();
|
||||
public Map<EpAuthPacketHeader, object> RemoteHeaders { get; set; } = new Map<EpAuthPacketHeader, object>();
|
||||
|
||||
public AuthenticationMethod LocalMethod { get; set; }
|
||||
public AuthenticationMethod RemoteMethod { get; set; }
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Esiur.Security.Membership
|
||||
public class AuthorizationRequest
|
||||
{
|
||||
public uint Reference { get; set; }
|
||||
public IIPAuthPacketIAuthDestination Destination { get; set; }
|
||||
public EpAuthPacketIAuthDestination Destination { get; set; }
|
||||
public string Clue { get; set; }
|
||||
public IIPAuthPacketIAuthFormat? RequiredFormat { get; set; }
|
||||
public IIPAuthPacketIAuthFormat? ContentFormat { get; set; }
|
||||
public EpAuthPacketIAuthFormat? RequiredFormat { get; set; }
|
||||
public EpAuthPacketIAuthFormat? ContentFormat { get; set; }
|
||||
public object? Content { get; set; }
|
||||
|
||||
public byte? Trials { get; set; }
|
||||
@@ -24,29 +24,29 @@ namespace Esiur.Security.Membership
|
||||
|
||||
public int Timeout => Expire.HasValue && Issue.HasValue ? (int)(Expire.Value - Issue.Value).TotalSeconds : 0;
|
||||
|
||||
public AuthorizationRequest(Map<IIPAuthPacketIAuthHeader, object> headers)
|
||||
public AuthorizationRequest(Map<EpAuthPacketIAuthHeader, object> headers)
|
||||
{
|
||||
Reference = (uint)headers[IIPAuthPacketIAuthHeader.Reference];
|
||||
Destination =(IIPAuthPacketIAuthDestination)headers[IIPAuthPacketIAuthHeader.Destination];
|
||||
Clue = (string)headers[IIPAuthPacketIAuthHeader.Clue];
|
||||
Reference = (uint)headers[EpAuthPacketIAuthHeader.Reference];
|
||||
Destination =(EpAuthPacketIAuthDestination)headers[EpAuthPacketIAuthHeader.Destination];
|
||||
Clue = (string)headers[EpAuthPacketIAuthHeader.Clue];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.RequiredFormat))
|
||||
RequiredFormat = (IIPAuthPacketIAuthFormat)headers[IIPAuthPacketIAuthHeader.RequiredFormat];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.RequiredFormat))
|
||||
RequiredFormat = (EpAuthPacketIAuthFormat)headers[EpAuthPacketIAuthHeader.RequiredFormat];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.ContentFormat))
|
||||
ContentFormat = (IIPAuthPacketIAuthFormat)headers[IIPAuthPacketIAuthHeader.ContentFormat];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.ContentFormat))
|
||||
ContentFormat = (EpAuthPacketIAuthFormat)headers[EpAuthPacketIAuthHeader.ContentFormat];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.Content))
|
||||
Content = headers[IIPAuthPacketIAuthHeader.Content];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.Content))
|
||||
Content = headers[EpAuthPacketIAuthHeader.Content];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.Trials))
|
||||
Trials = (byte)headers[IIPAuthPacketIAuthHeader.Trials];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.Trials))
|
||||
Trials = (byte)headers[EpAuthPacketIAuthHeader.Trials];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.Issue))
|
||||
Issue = (DateTime)headers[IIPAuthPacketIAuthHeader.Issue];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.Issue))
|
||||
Issue = (DateTime)headers[EpAuthPacketIAuthHeader.Issue];
|
||||
|
||||
if (headers.ContainsKey(IIPAuthPacketIAuthHeader.Expire))
|
||||
Expire = (DateTime)headers[IIPAuthPacketIAuthHeader.Expire];
|
||||
if (headers.ContainsKey(EpAuthPacketIAuthHeader.Expire))
|
||||
Expire = (DateTime)headers[EpAuthPacketIAuthHeader.Expire];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Esiur.Security.Membership
|
||||
|
||||
|
||||
public uint Reference { get; set; }
|
||||
public IIPAuthPacketIAuthDestination Destination { get; set; }
|
||||
public EpAuthPacketIAuthDestination Destination { get; set; }
|
||||
public string? Clue { get; set; }
|
||||
public IIPAuthPacketIAuthFormat? RequiredFormat { get; set; }
|
||||
public IIPAuthPacketIAuthFormat? ContentFormat { get; set; }
|
||||
public EpAuthPacketIAuthFormat? RequiredFormat { get; set; }
|
||||
public EpAuthPacketIAuthFormat? ContentFormat { get; set; }
|
||||
public object? Content { get; set; }
|
||||
|
||||
public byte? Trials { get; set; }
|
||||
|
||||
@@ -28,7 +28,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Esiur.Data;
|
||||
using Esiur.Net.IIP;
|
||||
using Esiur.Core;
|
||||
using Esiur.Security.Authority;
|
||||
using Esiur.Resource;
|
||||
@@ -47,8 +46,8 @@ public interface IMembership
|
||||
AsyncReply<byte[]> GetToken(ulong tokenIndex, string domain);
|
||||
AsyncReply<AuthorizationResults> Authorize(Session session);
|
||||
AsyncReply<AuthorizationResults> AuthorizePlain(Session session, uint reference, object value);
|
||||
AsyncReply<AuthorizationResults> AuthorizeHashed(Session session, uint reference, IIPAuthPacketHashAlgorithm algorithm, byte[] value);
|
||||
AsyncReply<AuthorizationResults> AuthorizeEncrypted(Session session, uint reference, IIPAuthPacketPublicKeyAlgorithm algorithm, byte[] value);
|
||||
AsyncReply<AuthorizationResults> AuthorizeHashed(Session session, uint reference, EpAuthPacketHashAlgorithm algorithm, byte[] value);
|
||||
AsyncReply<AuthorizationResults> AuthorizeEncrypted(Session session, uint reference, EpAuthPacketPublicKeyAlgorithm algorithm, byte[] value);
|
||||
|
||||
AsyncReply<bool> Login(Session session);
|
||||
AsyncReply<bool> Logout(Session session);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Esiur.Security.Membership
|
||||
var ar = new AuthorizationResults()
|
||||
{
|
||||
Clue = q.Question,
|
||||
Destination = IIPAuthPacketIAuthDestination.Self,
|
||||
Destination = EpAuthPacketIAuthDestination.Self,
|
||||
Reference = (uint)r.Next(),
|
||||
RequiredFormat = format,
|
||||
Expire = DateTime.Now.AddSeconds(60),
|
||||
@@ -96,14 +96,14 @@ namespace Esiur.Security.Membership
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncReply<AuthorizationResults> AuthorizeEncrypted(Session session, uint reference, IIPAuthPacketPublicKeyAlgorithm algorithm, byte[] value)
|
||||
public AsyncReply<AuthorizationResults> AuthorizeEncrypted(Session session, uint reference, EpAuthPacketPublicKeyAlgorithm algorithm, byte[] value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public AsyncReply<AuthorizationResults> AuthorizeHashed(Session session, uint reference, IIPAuthPacketHashAlgorithm algorithm, byte[] value)
|
||||
public AsyncReply<AuthorizationResults> AuthorizeHashed(Session session, uint reference, EpAuthPacketHashAlgorithm algorithm, byte[] value)
|
||||
{
|
||||
if (algorithm != IIPAuthPacketHashAlgorithm.SHA256)
|
||||
if (algorithm != EpAuthPacketHashAlgorithm.SHA256)
|
||||
throw new NotImplementedException();
|
||||
|
||||
var ar = users[session.AuthorizedAccount].Results.First(x => x.Reference == reference);
|
||||
@@ -112,8 +112,8 @@ namespace Esiur.Security.Membership
|
||||
|
||||
|
||||
// compute hash
|
||||
var remoteNonce = (byte[])session.RemoteHeaders[IIPAuthPacketHeader.Nonce];
|
||||
var localNonce = (byte[])session.LocalHeaders[IIPAuthPacketHeader.Nonce];
|
||||
var remoteNonce = (byte[])session.RemoteHeaders[EpAuthPacketHeader.Nonce];
|
||||
var localNonce = (byte[])session.LocalHeaders[EpAuthPacketHeader.Nonce];
|
||||
|
||||
var hashFunc = SHA256.Create();
|
||||
// local nonce + password or token + remote nonce
|
||||
|
||||
@@ -29,7 +29,7 @@ using Esiur.Data;
|
||||
using Esiur.Core;
|
||||
using Esiur.Resource;
|
||||
using Esiur.Security.Authority;
|
||||
using Esiur.Data.Schema;
|
||||
using Esiur.Data.Types;
|
||||
|
||||
namespace Esiur.Security.Permissions;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class StorePermissionsManager : IPermissionsManager
|
||||
|
||||
public Map<string,object> Settings => settings;
|
||||
|
||||
public Ruling Applicable(IResource resource, Session session, ActionType action, MemberDefinition member, object inquirer = null)
|
||||
public Ruling Applicable(IResource resource, Session session, ActionType action, MemberDef member, object inquirer = null)
|
||||
{
|
||||
return resource.Instance.Store.Instance.Applicable(session, action, member, inquirer);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ using Esiur.Data;
|
||||
using Esiur.Core;
|
||||
using Esiur.Resource;
|
||||
using Esiur.Security.Authority;
|
||||
using Esiur.Data.Schema;
|
||||
using Esiur.Data.Types;
|
||||
|
||||
namespace Esiur.Security.Permissions;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class UserPermissionsManager : IPermissionsManager
|
||||
|
||||
public Map<string,object> Settings => settings;
|
||||
|
||||
public Ruling Applicable(IResource resource, Session session, ActionType action, MemberDefinition member, object inquirer)
|
||||
public Ruling Applicable(IResource resource, Session session, ActionType action, MemberDef member, object inquirer)
|
||||
{
|
||||
Map<string,object> userPermissions = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user