mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
14 lines
444 B
TypeScript
14 lines
444 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {SsoRequiredError} from '@fluxer/errors/src/domains/auth/SsoRequiredError';
|
|
import {createMiddleware} from 'hono/factory';
|
|
import type {HonoEnv} from '../types/HonoEnv';
|
|
|
|
export const LocalAuthMiddleware = createMiddleware<HonoEnv>(async (ctx, next) => {
|
|
const ssoService = ctx.get('ssoService');
|
|
if (await ssoService.isEnforced()) {
|
|
throw new SsoRequiredError();
|
|
}
|
|
await next();
|
|
});
|