3using System.Reflection;
5using System.Threading.Tasks;
53 await
BadRequest(Response,
"invalid_request",
"No resource subpath provided.");
58 out
HttpResource Resource, out
string SubPath) ??
false) ||
59 !
string.IsNullOrEmpty(SubPath))
66 string ServerUrl = sb.ToString();
69 string ResourceUrl = sb.ToString();
73 if (Request.
Server is
null)
78 Dictionary<string, object> MetaData =
new Dictionary<string, object>()
80 {
"resource", ResourceUrl },
81 {
"authorization_servers",
new string[] { ServerUrl } },
82 {
"bearer_methods_supported",
new string[] {
"header",
"body" } },
83 {
"tls_client_certificate_bound_access_tokens", ClientCertificatesConfig != ClientCertificates.NotUsed }
91 await Response.Return(MetaData);
126 string? Host, out
int Port)
128 StringBuilder sb =
new StringBuilder();
136 if ((Ports?.Length ?? 0) > 0)
155 sb.Append(Host ??
"localhost");
160 sb.Append(Port.ToString());
166 private static int GetPort(
int[]? Ports,
int DefaultPort)
168 if (Ports is
null || Ports.Length == 0)
184 sb.Append(this.ResourceName);
186 return sb.ToString();
Represents an HTTP request.
bool Encrypted
If the connection is encrypted or not.
string SubPath
Sub-path. If a resource is found handling the request, this property contains the trailing sub-path o...
string Host
Host reference. (Value of Host header, without the port number)
HttpServer Server
HTTP Server receiving the request.
Base class for all HTTP resources.
HttpServer FirstServer
First server on which the resource has been registered.
string ResourceName
Name of resource.
Represets a response of an HTTP client request.
Implements an HTTP server.
bool TryGetResource(HttpRequest Request, out HttpResource Resource, out string SubPath)
Tries to get a resource from the server.
const int DefaultHttpPort
Default HTTP Port (80).
void GetMTlsSettings(int Port, out ClientCertificates ClientCertificates, out bool TrustClientCertificates)
Gets mTLS settings for a given port number.
int[] OpenHttpsPorts
HTTPS Ports successfully opened.
const int DefaultHttpsPort
Default HTTPS port (443).
Manages the OAuth 2 environment.
void Register(OAuthAuthorizeResource? AuthorizeResource)
Registers an authorization resource.
Abstract base class for OAUTH resources.
OAuth2Environment Environment
OAUTH2 environment, used to access clients, tokens, and other resources.
bool Encrypted
If TLS-encryption is enabled.
static Task BadRequest(HttpResponse Response, string ErrorCode, string ErrorDescription)
Returns a Bad Request error back to the client.
static Task NotFound(HttpResponse Response, string ErrorCode, string ErrorDescription)
Returns a Not Found error back to the client.
GET Interface for HTTP resources.
ClientCertificates
Client Certificate Options