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