class Authorization extends HttpApiMiddleware.Tag<Authorization>()(
'@markprompt/Authorization',
{
// add your error schema
failure: Unauthorized,
// add the Context.Tag that the middleware will provide
provides: ProjectRouteParams,
// add the security definitions
security: {
// the object key is a custom name for the security definition
bearer: HttpApiSecurity.bearer,
// You can add more security definitions here.
// They will attempt to be resolved in the order they are defined
},
},
) {}
export const AuthorizationLive = Layer.effect(
Authorization,
Effect.gen(function* () {
yield* Effect.log('creating Authorization middleware');
// return the security handlers
return Authorization.of({
bearer: (bearerToken) =>
Effect.gen(function* () {
return yield* Effect.succeed({
projectId: 'testing',
});
}),
});
}),
);
class Authorization extends HttpApiMiddleware.Tag<Authorization>()(
'@markprompt/Authorization',
{
// add your error schema
failure: Unauthorized,
// add the Context.Tag that the middleware will provide
provides: ProjectRouteParams,
// add the security definitions
security: {
// the object key is a custom name for the security definition
bearer: HttpApiSecurity.bearer,
// You can add more security definitions here.
// They will attempt to be resolved in the order they are defined
},
},
) {}
export const AuthorizationLive = Layer.effect(
Authorization,
Effect.gen(function* () {
yield* Effect.log('creating Authorization middleware');
// return the security handlers
return Authorization.of({
bearer: (bearerToken) =>
Effect.gen(function* () {
return yield* Effect.succeed({
projectId: 'testing',
});
}),
});
}),
);