Skip to content

Commit 378e4cf

Browse files
committed
remove authenticated request
1 parent f7bfc72 commit 378e4cf

File tree

3 files changed

+1
-89
lines changed

3 files changed

+1
-89
lines changed

src/Request.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import http, {OutgoingHttpHeader} from "node:http";
44
import stream from "node:stream";
55
import {Authenticator} from "./auth/Authenticator.js";
66
import {Authorisation} from "./auth/Authorisation.js";
7-
import {AuthenticatedRequest} from "./auth/AuthenticatedRequest.js";
87
import {Server} from "./Server.js";
98

109
/**
@@ -158,24 +157,6 @@ export class Request<A> {
158157
return await authenticator.authenticate(this);
159158
}
160159

161-
/**
162-
* Attempt to authenticate this request with one of the {@link Server}’s {@link Authenticator}s.
163-
* @returns `null` if the request lacks authorisation information.
164-
*/
165-
public async authenticate(): Promise<AuthenticatedRequest<A> | null> {
166-
const authorisation = await this.getAuthorisation();
167-
if (authorisation === null) return null;
168-
return new AuthenticatedRequest<A>(
169-
authorisation,
170-
this.method,
171-
this.url,
172-
this.headers,
173-
this.bodyStream,
174-
this.ip,
175-
this.server,
176-
);
177-
}
178-
179160
/**
180161
* Returns a boolean value that declares whether the body has been read yet.
181162
*/

src/auth/AuthenticatedRequest.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/auth/Authenticator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface Authenticator<A extends any> {
1313
canAuthenticate(request: Request<A>): boolean;
1414

1515
/**
16-
* Authenticate the given request. If authenticate fails, e.g. due to missing or invalid information, such as
16+
* Authenticate the given request. If authentication fails, e.g. due to missing or invalid information, such as
1717
* credentials, the authenticator should return `null`, which can be communicated to the client by implementing
1818
* applications using a 401 status response.
1919
* @param request

0 commit comments

Comments
 (0)