// Create the Authorization middleware
export class Authorization extends HttpApiMiddleware.Tag<Authorization>()(
"Authorization",
{
// Define the error schema for unauthorized access
failure: Unauthorized,
// Specify the resource this middleware will provide
// provides: CurrentUser,
// Add security definitions
security: {
// ┌─── Custom name for the security definition
// ▼
token: HttpApiSecurity.apiKey({
in: "header",
key: "hi",
}),
// Additional security definitions can be added here.
// They will attempt to be resolved in the order they are defined.
},
},
) {}
// Create the Authorization middleware
export class Authorization extends HttpApiMiddleware.Tag<Authorization>()(
"Authorization",
{
// Define the error schema for unauthorized access
failure: Unauthorized,
// Specify the resource this middleware will provide
// provides: CurrentUser,
// Add security definitions
security: {
// ┌─── Custom name for the security definition
// ▼
token: HttpApiSecurity.apiKey({
in: "header",
key: "hi",
}),
// Additional security definitions can be added here.
// They will attempt to be resolved in the order they are defined.
},
},
) {}