mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat(infisical-pg): fixed ts issue on passport type change
This commit is contained in:
@@ -127,7 +127,7 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
|
||||
// this is due to zod type difference
|
||||
}) as any,
|
||||
handler: (req, res) => {
|
||||
if (req.passportUser.isCompleted) {
|
||||
if (req.passportUser.isUserCompleted) {
|
||||
return res.redirect(
|
||||
`${appCfg.SITE_URL}/login/sso?token=${encodeURIComponent(
|
||||
req.passportUser.providerAuthToken
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ForbiddenError } from "@casl/ability";
|
||||
|
||||
import { BadRequestError, InternalServerError } from "@app/lib/errors";
|
||||
import { groupBy } from "@app/lib/fn";
|
||||
import { logger } from "@app/lib/logger";
|
||||
import { TSecretDalFactory } from "@app/services/secret/secret-dal";
|
||||
import { TSecretVersionDalFactory } from "@app/services/secret/secret-version-dal";
|
||||
import { TSecretFolderDalFactory } from "@app/services/secret-folder/secret-folder-dal";
|
||||
@@ -19,7 +20,6 @@ import {
|
||||
import { TSnapshotDalFactory } from "./snapshot-dal";
|
||||
import { TSnapshotFolderDalFactory } from "./snapshot-folder-dal";
|
||||
import { TSnapshotSecretDalFactory } from "./snapshot-secret-dal";
|
||||
import { logger } from "@app/lib/logger";
|
||||
|
||||
type TSecretSnapshotServiceFactoryDep = {
|
||||
snapshotDal: TSnapshotDalFactory;
|
||||
|
||||
@@ -114,7 +114,6 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
||||
authMethod: AuthMethod.GITLAB,
|
||||
callbackPort: req.query.state as string
|
||||
});
|
||||
console.log({ isUserCompleted, providerAuthToken });
|
||||
|
||||
return cb(null, { isUserCompleted, providerAuthToken });
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
||||
...req.body,
|
||||
ip: req.realIp,
|
||||
userAgent,
|
||||
authorization: req.headers.authorization
|
||||
authorization: req.headers.authorization as string
|
||||
});
|
||||
|
||||
res.setCookie("jid", refreshToken, {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import jwt from "jsonwebtoken";
|
||||
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
|
||||
|
||||
import {
|
||||
AuthModeProviderJwtTokenPayload,
|
||||
AuthModeProviderSignUpTokenPayload,
|
||||
AuthTokenType
|
||||
} from "./auth-type";
|
||||
import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
|
||||
|
||||
export const validateProviderAuthToken = (providerToken: string, email: string) => {
|
||||
if (!providerToken) throw new UnauthorizedError();
|
||||
@@ -15,7 +17,6 @@ export const validateProviderAuthToken = (providerToken: string, email: string)
|
||||
appCfg.JWT_AUTH_SECRET
|
||||
) as AuthModeProviderJwtTokenPayload;
|
||||
|
||||
console.log(decodedToken);
|
||||
if (decodedToken.authTokenType !== AuthTokenType.PROVIDER_TOKEN) throw new UnauthorizedError();
|
||||
if (decodedToken.email !== email) throw new Error("Invalid auth credentials");
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import { TAuthTokenServiceFactory } from "../auth-token/auth-token-service";
|
||||
import { TokenType } from "../auth-token/auth-token-types";
|
||||
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
|
||||
import { TUserDalFactory } from "../user/user-dal";
|
||||
import { validateProviderAuthToken } from "./auth-fns";
|
||||
import {
|
||||
TLoginClientProofDTO,
|
||||
TLoginGenServerPublicKeyDTO,
|
||||
@@ -16,7 +17,6 @@ import {
|
||||
TVerifyMfaTokenDTO
|
||||
} from "./auth-login-type";
|
||||
import { AuthMethod, AuthTokenType } from "./auth-type";
|
||||
import { validateProviderAuthToken } from "./auth-fns";
|
||||
|
||||
type TAuthLoginServiceFactoryDep = {
|
||||
userDal: TUserDalFactory;
|
||||
|
||||
@@ -13,9 +13,9 @@ import { TOrgServiceFactory } from "../org/org-service";
|
||||
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
|
||||
import { TUserDalFactory } from "../user/user-dal";
|
||||
import { TAuthDalFactory } from "./auth-dal";
|
||||
import { validateProviderAuthToken, validateSignUpAuthorization } from "./auth-fns";
|
||||
import { TCompleteAccountInviteDTO, TCompleteAccountSignupDTO } from "./auth-signup-type";
|
||||
import { AuthMethod, AuthTokenType } from "./auth-type";
|
||||
import { validateProviderAuthToken, validateSignUpAuthorization } from "./auth-fns";
|
||||
|
||||
type TAuthSignupDep = {
|
||||
authDal: TAuthDalFactory;
|
||||
|
||||
@@ -9,6 +9,7 @@ import { BadRequestError } from "@app/lib/errors";
|
||||
import { TProjectPermission } from "@app/lib/types";
|
||||
|
||||
import { TIntegrationAuthDalFactory } from "../integration-auth/integration-auth-dal";
|
||||
import { TSecretQueueFactory } from "../secret/secret-queue";
|
||||
import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
|
||||
import { TIntegrationDalFactory } from "./integration-dal";
|
||||
import {
|
||||
@@ -16,7 +17,6 @@ import {
|
||||
TDeleteIntegrationDTO,
|
||||
TUpdateIntegrationDTO
|
||||
} from "./integration-types";
|
||||
import { TSecretQueueFactory } from "../secret/secret-queue";
|
||||
|
||||
type TIntegrationServiceFactoryDep = {
|
||||
integrationDal: TIntegrationDalFactory;
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
|
||||
import { TProjectDalFactory } from "../project/project-dal";
|
||||
import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
|
||||
import { TProjectEnvDalFactory } from "./project-env-dal";
|
||||
import { TCreateEnvDTO, TDeleteEnvDTO, TUpdateEnvDTO } from "./project-env-types";
|
||||
import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
|
||||
|
||||
type TProjectEnvServiceFactoryDep = {
|
||||
projectEnvDal: TProjectEnvDalFactory;
|
||||
|
||||
@@ -7,10 +7,10 @@ import { getConfig } from "@app/lib/config/env";
|
||||
import { request } from "@app/lib/config/request";
|
||||
import { decryptSymmetric, decryptSymmetric128BitHexKeyUTF8 } from "@app/lib/crypto";
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
import { logger } from "@app/lib/logger";
|
||||
|
||||
import { TProjectEnvDalFactory } from "../project-env/project-env-dal";
|
||||
import { TWebhookDalFactory } from "./webhook-dal";
|
||||
import { logger } from "@app/lib/logger";
|
||||
|
||||
const WEBHOOK_TRIGGER_TIMEOUT = 15 * 1000;
|
||||
export const triggerWebhookRequest = async (
|
||||
|
||||
Reference in New Issue
Block a user