Switch over to a check-based system with multi attribute support

This commit is contained in:
GHXX committed 2024-07-19 03:31:04 +02:00
1 parent fa79134d02
commit c75d29a1ba
4 files changed
+53 -27

No files matched your search

+2 -10
View File
@@ -1,23 +1,15 @@
using SimpleHttpServer.Internal;
using SimpleHttpServer.Types;
using SimpleHttpServer.Types;
namespace SimpleHttpServer;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class HttpEndpointAttribute<T> : Attribute where T : IAuthorizer {
public class HttpEndpointAttribute : Attribute {
public HttpRequestType RequestMethod { get; private set; }
public string[] Locations { get; private set; }
public Type Authorizer { get; private set; }
public HttpEndpointAttribute(HttpRequestType requestMethod, params string[] locations) {
RequestMethod = requestMethod;
Locations = locations;
Authorizer = typeof(T);
}
}
[AttributeUsage(AttributeTargets.Method)]
public class HttpEndpointAttribute : HttpEndpointAttribute<DefaultAuthorizer> {
public HttpEndpointAttribute(HttpRequestType type, params string[] locations) : base(type, locations) { }
}