diff --git a/src/Nuxed/Contract/Http/Message/IServerRequest.hack b/src/Nuxed/Contract/Http/Message/IServerRequest.hack index 7cbcd2b..af474bd 100644 --- a/src/Nuxed/Contract/Http/Message/IServerRequest.hack +++ b/src/Nuxed/Contract/Http/Message/IServerRequest.hack @@ -1,6 +1,6 @@ namespace Nuxed\Contract\Http\Message; -use namespace Nuxed\Contract\Http\{Flash, Server, Session}; +use namespace Nuxed\Contract\Http\{Flash, Session}; /** * Representation of an incoming, server-side HTTP request. @@ -209,21 +209,6 @@ interface IServerRequest extends IRequest { */ public function withoutAttribute(string $attribute): this; - /** - * Return the http principal, which represent a user authenticated by HTTP Basic or - * Digest authentication. A null value indicates the absence of a user authentication. - */ - public function getPrincipal(): ?Server\IHttpPrincipal; - - /** - * Return an instance with the specified http principal implementation. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * http principal instance. - */ - public function withPrincipal(Server\IHttpPrincipal $principal): this; - /** * Return an instance with the specified session implementation. * diff --git a/src/Nuxed/Contract/Http/Server/Authenticator/IAuthenticator.hack b/src/Nuxed/Contract/Http/Server/Authenticator/IAuthenticator.hack deleted file mode 100644 index 032596d..0000000 --- a/src/Nuxed/Contract/Http/Server/Authenticator/IAuthenticator.hack +++ /dev/null @@ -1,9 +0,0 @@ -namespace Nuxed\Contract\Http\Server\Authenticator; - -use namespace Nuxed\Contract\Http\Message; - -interface IAuthenticator { - public function authenticate( - Message\IServerRequest $request, - ): Awaitable; -} diff --git a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Failure.hack b/src/Nuxed/Contract/Http/Server/Authenticator/Result/Failure.hack deleted file mode 100644 index 651939a..0000000 --- a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Failure.hack +++ /dev/null @@ -1,17 +0,0 @@ -namespace Nuxed\Contract\Http\Server\Authenticator\Result; - -/** - * Indicates an authentication failure. - * - * The authentication attempt has completed. - */ -final class Failure implements IResult { - public function __construct(private int $responseCode) {} - - /** - * returns the response code to send to the client. - */ - public function getResponseCode(): int { - return $this->responseCode; - } -} diff --git a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Result.hack b/src/Nuxed/Contract/Http/Server/Authenticator/Result/Result.hack deleted file mode 100644 index e9512d8..0000000 --- a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Result.hack +++ /dev/null @@ -1,4 +0,0 @@ -namespace Nuxed\Contract\Http\Server\Authenticator\Result; - -<<__Sealed(Success::class, Failure::class, Retry::class)>> -interface IResult {} diff --git a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Retry.hack b/src/Nuxed/Contract/Http/Server/Authenticator/Result/Retry.hack deleted file mode 100644 index 56364a7..0000000 --- a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Retry.hack +++ /dev/null @@ -1,20 +0,0 @@ -namespace Nuxed\Contract\Http\Server\Authenticator\Result; - -/** - * Indicates an authentication must be retried. - * - * The response code to be sent back is as returned from getResponseCode(). - * - * The Authenticator must also have set any necessary response headers - * before returning this Retry object. - */ -final class Retry implements IResult { - public function __construct(private int $responseCode) {} - - /** - * returns the response code to send to the client. - */ - public function getResponseCode(): int { - return $this->responseCode; - } -} diff --git a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Success.hack b/src/Nuxed/Contract/Http/Server/Authenticator/Result/Success.hack deleted file mode 100644 index 9c6c695..0000000 --- a/src/Nuxed/Contract/Http/Server/Authenticator/Result/Success.hack +++ /dev/null @@ -1,18 +0,0 @@ -namespace Nuxed\Contract\Http\Server\Authenticator\Result; - -use namespace Nuxed\Contract\Http\Server; - -/** - * Indicates an authentication has succeeded and the authenticated - * user principal can be acquired by calling getPrincipal(). - */ -final class Success implements IResult { - public function __construct(private Server\IHttpPrincipal $httpPrincipal) {} - - /** - * returns the authenticated user Principal - */ - public function getPrincipal(): Server\IHttpPrincipal { - return $this->httpPrincipal; - } -} diff --git a/src/Nuxed/Contract/Http/Server/IHttpPrincipal.hack b/src/Nuxed/Contract/Http/Server/IHttpPrincipal.hack deleted file mode 100644 index 61cd7fd..0000000 --- a/src/Nuxed/Contract/Http/Server/IHttpPrincipal.hack +++ /dev/null @@ -1,26 +0,0 @@ -namespace Nuxed\Contract\Http\Server; - -/** - * Represents a user authenticated by HTTP Basic or Digest authentication. - */ -interface IHttpPrincipal { - /** - * returns the contents of this principal in the form realm:username - */ - public function getName(): string; - - /** - * returns the realm this object was created with. - */ - public function getRealm(): string; - - /** - * returns the username this object was created with. - */ - public function getUsername(): string; - - /** - * returns a hashcode for this HttpPrincipal. - */ - public function hashCode(): int; -} diff --git a/src/Nuxed/Contract/Http/Server/IServer.hack b/src/Nuxed/Contract/Http/Server/IServer.hack deleted file mode 100644 index 4129e1a..0000000 --- a/src/Nuxed/Contract/Http/Server/IServer.hack +++ /dev/null @@ -1,41 +0,0 @@ -namespace Nuxed\Contract\Http\Server; - -interface IServer { - /** - * Sets the Authenticator for this server. - */ - public function setAuthenticator( - ?Authenticator\IAuthenticator $authenticator, - ): void; - - /** - * Sets the handler for this server. - */ - public function setHandler(IHandler $handler): void; - - /** - * Sets the middleware stack for this server. - */ - public function setMiddlewareStack(IMiddlewareStack $middleware): void; - - /** - * Binds this server to the given address and port number. - */ - public function bind(string $address, int $port = 8080): void; - - /** - * returns the address this server is listening on. - */ - public function getAddress(): string; - - /** - * Starts the server in the background. - */ - public function start(): Awaitable; - - /** - * Stops this server by closing the listening socket and disallowing any new requests - * from being processed. - */ - public function stop(int $deply = 0): Awaitable; -}