26 lines
554 B
C#
26 lines
554 B
C#
using System.Net;
|
|
|
|
namespace Pilz.Net.Api;
|
|
|
|
public class ApiAuthCheckEventArgs(string authKey, Delegate? handler, HttpListenerContext context) : EventArgs
|
|
{
|
|
private bool hasDenyed;
|
|
|
|
public HttpListenerContext Context { get; } = context;
|
|
public Delegate? Handler { get; } = handler;
|
|
public string AuthKey { get; } = authKey;
|
|
public bool Valid { get; set; }
|
|
|
|
public void Deny()
|
|
{
|
|
Valid = false;
|
|
hasDenyed = true;
|
|
}
|
|
|
|
public void Permit()
|
|
{
|
|
if (!hasDenyed)
|
|
Valid = true;
|
|
}
|
|
}
|