ln.http/ln.http/HttpContext.cs

24 lines
702 B
C#

using ln.http.router;
namespace ln.http
{
public class HttpContext
{
public HttpRequest Request { get; set; }
public HttpResponse Response { get; set; }
public HttpPrincipal AuthenticatedPrincipal { get; private set; }
public string RoutableUri { get; set; }
public bool Authenticate(HttpAuthenticationDelegate authenticationDelegate)
{
if (authenticationDelegate(this, out HttpPrincipal principal))
{
AuthenticatedPrincipal = principal;
return true;
}
return false;
}
public void DeAuthenticate() => AuthenticatedPrincipal = null;
}
}