mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 10:27:26 +00:00
Fix type/lint issues
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
// All the any rules are disabled because passport typesense with fastify is really poor
|
// All the any rules are disabled because passport typesense with fastify is really poor
|
||||||
|
|
||||||
|
import { IncomingMessage } from "node:http";
|
||||||
|
|
||||||
import { Authenticator } from "@fastify/passport";
|
import { Authenticator } from "@fastify/passport";
|
||||||
import fastifySession from "@fastify/session";
|
import fastifySession from "@fastify/session";
|
||||||
import { FastifyRequest } from "fastify";
|
import { FastifyRequest } from "fastify";
|
||||||
@@ -27,15 +29,16 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
passport.use(
|
passport.use(
|
||||||
new LdapStrategy(
|
new LdapStrategy(
|
||||||
server.services.ldap.getLdapPassportOpts,
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
|
server.services.ldap.getLdapPassportOpts as any,
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
async (req, user, cb) => {
|
async (req: IncomingMessage, user, cb) => {
|
||||||
try {
|
try {
|
||||||
const { isUserCompleted, providerAuthToken } = await server.services.ldap.ldapLogin({
|
const { isUserCompleted, providerAuthToken } = await server.services.ldap.ldapLogin({
|
||||||
username: user.uid,
|
username: user.uid,
|
||||||
firstName: user.givenName,
|
firstName: user.givenName,
|
||||||
lastName: user.sn,
|
lastName: user.sn,
|
||||||
relayState: (req.body as { RelayState?: string }).RelayState,
|
relayState: ((req as unknown as FastifyRequest).body as { RelayState?: string }).RelayState,
|
||||||
orgId: (req as unknown as FastifyRequest).ldapConfig.organization
|
orgId: (req as unknown as FastifyRequest).ldapConfig.organization
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import { TPermissionServiceFactory } from "../permission/permission-service";
|
|||||||
import { TLdapConfigDALFactory } from "./ldap-config-dal";
|
import { TLdapConfigDALFactory } from "./ldap-config-dal";
|
||||||
import { TCreateLdapCfgDTO, TLdapLoginDTO, TUpdateLdapCfgDTO } from "./ldap-config-types";
|
import { TCreateLdapCfgDTO, TLdapLoginDTO, TUpdateLdapCfgDTO } from "./ldap-config-types";
|
||||||
|
|
||||||
// TODO: check the Picks
|
|
||||||
type TLdapConfigServiceFactoryDep = {
|
type TLdapConfigServiceFactoryDep = {
|
||||||
ldapConfigDAL: TLdapConfigDALFactory;
|
ldapConfigDAL: TLdapConfigDALFactory;
|
||||||
orgDAL: Pick<
|
orgDAL: Pick<
|
||||||
@@ -320,7 +319,7 @@ export const ldapConfigServiceFactory = ({
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
done(err as Error);
|
done(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { ActorType } from "@app/services/auth/auth-type";
|
|||||||
// this is a unique id for sending posthog event
|
// this is a unique id for sending posthog event
|
||||||
export const getTelemetryDistinctId = (req: FastifyRequest) => {
|
export const getTelemetryDistinctId = (req: FastifyRequest) => {
|
||||||
if (req.auth.actor === ActorType.USER) {
|
if (req.auth.actor === ActorType.USER) {
|
||||||
return req.auth.user.email;
|
return req.auth.user.username;
|
||||||
}
|
}
|
||||||
if (req.auth.actor === ActorType.IDENTITY) {
|
if (req.auth.actor === ActorType.IDENTITY) {
|
||||||
return `identity-${req.auth.identityId}`;
|
return `identity-${req.auth.identityId}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user