23 lines
729 B
C#
23 lines
729 B
C#
using SimpleHttpServer.Internal;
|
|
|
|
namespace SimpleHttpServer;
|
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
|
public class HttpRoute<T> : Attribute where T : IAuthorizer {
|
|
|
|
public HttpRequestType RequestMethod { get; private set; }
|
|
public string Location { get; private set; }
|
|
public Type Authorizer { get; private set; }
|
|
|
|
public HttpRoute(HttpRequestType requestMethod, string location) {
|
|
RequestMethod = requestMethod;
|
|
Location = location;
|
|
Authorizer = typeof(T);
|
|
}
|
|
}
|
|
|
|
[AttributeUsage(AttributeTargets.Method)]
|
|
public class HttpEndpoint : HttpRoute<DefaultAuthorizer> {
|
|
public HttpEndpoint(HttpRequestType type, string location) : base(type, location) { }
|
|
}
|