mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
auth
This commit is contained in:
parent
47a816f700
commit
4d7edab0ac
@ -781,7 +781,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
|
||||
}
|
||||
}
|
||||
|
||||
//Console.WriteLine(msg.GetString(offset, ends - offset));
|
||||
|
||||
|
||||
var rt = authPacket.Parse(msg, offset, ends);
|
||||
|
||||
@ -980,6 +980,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
|
||||
//SendParams((byte)0, localHash);
|
||||
|
||||
var localHash = hashFunc.ComputeHash((new BinaryList()).AddUInt8Array(localNonce).AddUInt8Array(remoteNonce).AddUInt8Array(pw).ToArray());
|
||||
|
||||
SendParams().AddUInt8(0).AddUInt8Array(localHash).Done();
|
||||
|
||||
readyToEstablish = true;
|
||||
|
@ -52,7 +52,6 @@ public class Session
|
||||
|
||||
public Session(Authentication localAuthentication, Authentication remoteAuthentication)
|
||||
{
|
||||
|
||||
this.localAuth = localAuthentication;
|
||||
this.remoteAuth = remoteAuthentication;
|
||||
}
|
||||
|
13
Esiur/Security/Membership/AuthorizationResponse.cs
Normal file
13
Esiur/Security/Membership/AuthorizationResponse.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Esiur.Security.Authority;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Security.Membership
|
||||
{
|
||||
public class AuthorizationResponse
|
||||
{
|
||||
public Session Session { get; set; }
|
||||
public bool Succeeded { get; set; }
|
||||
}
|
||||
}
|
16
Esiur/Security/Membership/AuthorizationResults.cs
Normal file
16
Esiur/Security/Membership/AuthorizationResults.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Security.Membership
|
||||
{
|
||||
public class AuthorizationResults
|
||||
{
|
||||
AuthorizationResultsResponse Response { get; set; }
|
||||
TwoFactorAuthorizationMethod TwoFactorMethod { get; set; }
|
||||
public string Clue { get; set; }
|
||||
public string AppName { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Timeout { get; set; }
|
||||
}
|
||||
}
|
13
Esiur/Security/Membership/AuthorizationResultsResponse.cs
Normal file
13
Esiur/Security/Membership/AuthorizationResultsResponse.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Security.Membership
|
||||
{
|
||||
public enum AuthorizationResultsResponse
|
||||
{
|
||||
Success,
|
||||
ServiceUnavailable,
|
||||
TwoFactoryAuthorization,
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2017 Ahmed Kh. Zamil
|
||||
Copyright (c) 2017-2024 Ahmed Kh. Zamil
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@ -37,11 +37,17 @@ namespace Esiur.Security.Membership;
|
||||
|
||||
public interface IMembership
|
||||
{
|
||||
public event ResourceEventHandler<AuthorizationResponse> Authorization;
|
||||
|
||||
AsyncReply<bool> UserExists(string username, string domain);
|
||||
AsyncReply<byte[]> GetPassword(string username, string domain);
|
||||
AsyncReply<byte[]> GetToken(ulong tokenIndex, string domain);
|
||||
AsyncReply<AuthorizationResults> Authorize(Session session);
|
||||
AsyncReply<bool> Login(Session session);
|
||||
AsyncReply<bool> Logout(Session session);
|
||||
bool GuestsAllowed { get; }
|
||||
AsyncReply<string> TokenExists(ulong tokenIndex, string domain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
15
Esiur/Security/Membership/TwoFactorAuthorizationMethod.cs
Normal file
15
Esiur/Security/Membership/TwoFactorAuthorizationMethod.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Security.Membership
|
||||
{
|
||||
public enum TwoFactorAuthorizationMethod
|
||||
{
|
||||
Email,
|
||||
SMS,
|
||||
App,
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user