Files
FastGPT/packages/service/support/permission/auth/common.ts
Archer 42a8184ea0 v4.6.9-alpha (#918)
Co-authored-by: Mufei <327958099@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-03-04 00:05:25 +08:00

21 lines
544 B
TypeScript

import { parseHeaderCert } from '../controller';
import { AuthModeType } from '../type';
import { SERVICE_LOCAL_HOST } from '../../../common/system/tools';
export const authCert = async (props: AuthModeType) => {
const result = await parseHeaderCert(props);
return {
...result,
isOwner: true,
canWrite: true
};
};
/* auth the request from local service */
export const authRequestFromLocal = ({ req }: AuthModeType) => {
if (req.headers.host !== SERVICE_LOCAL_HOST) {
return Promise.reject('Invalid request');
}
};