23 lines
809 B
C#
23 lines
809 B
C#
using SimpleHttpServer.Internal;
|
|
|
|
namespace SimpleHttpServer;
|
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
|
public class HttpEndpointAttribute<T> : Attribute where T : IAuthorizer {
|
|
|
|
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) { }
|
|
}
|