Skip to content

Commit 7450465

Browse files
committed
Merge branch 'cezudas/OPS-3021-move-encrypted-type' into cezudas/OPS-3021-extend-tables-context
2 parents 39ac1e8 + 97ae81a commit 7450465

13 files changed

Lines changed: 46 additions & 25 deletions

File tree

packages/openops/src/lib/axios-wrapper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export async function makeHttpRequest<T>(
3939

4040
if (axiosError && axiosError.response?.data) {
4141
logger.error(logMessage, {
42-
...axiosError.response?.data,
42+
error: axiosError,
43+
errorResponse: axiosError.response?.data,
4344
status: axiosError.response?.status,
4445
statusText: axiosError.response?.statusText,
4546
timeTaken,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { FlagsMap } from '@/app/lib/flags-api';
2+
3+
export const getFederatedUrlBasedOnFlags = (flags: FlagsMap) =>
4+
flags.FEDERATED_LOGIN_ENABLED
5+
? (flags.FRONTEGG_URL as string | undefined)
6+
: undefined;

packages/react-ui/src/app/common/guards/allow-logged-in-user-only-guard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { jwtDecode } from 'jwt-decode';
44
import { Suspense, useEffect } from 'react';
55
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
66

7+
import { getFederatedUrlBasedOnFlags } from '@/app/common/auth/lib/utils';
78
import { flagsHooks } from '@/app/common/hooks/flags-hooks';
89
import { platformHooks } from '@/app/common/hooks/platform-hooks';
910
import { projectHooks } from '@/app/common/hooks/project-hooks';
@@ -61,7 +62,7 @@ export const AllowOnlyLoggedInUserOnlyGuard = ({
6162
await authenticationSession.logOut({
6263
userInitiated: false,
6364
navigate,
64-
federatedLoginUrl: flags?.FRONTEGG_URL as string | undefined,
65+
federatedLoginUrl: getFederatedUrlBasedOnFlags(flags),
6566
});
6667
} catch (e) {
6768
if (isMounted) {

packages/react-ui/src/app/features/authentication/components/sign-in-form.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { t } from 'i18next';
1515
import { SubmitHandler, useForm } from 'react-hook-form';
1616
import { Link, useNavigate } from 'react-router-dom';
1717

18+
import { getFederatedUrlBasedOnFlags } from '@/app/common/auth/lib/utils';
1819
import { flagsHooks } from '@/app/common/hooks/flags-hooks';
1920
import { HttpError, api } from '@/app/lib/api';
2021
import { authenticationApi } from '@/app/lib/authentication-api';
@@ -26,7 +27,7 @@ import {
2627
SignInRequest,
2728
emailRegex,
2829
} from '@openops/shared';
29-
import { useEffectOnce } from 'react-use';
30+
import { useEffect } from 'react';
3031
import { navigationUtil } from '../../../lib/navigation-util';
3132

3233
const SignInSchema = Type.Object({
@@ -52,11 +53,17 @@ const SignInForm: React.FC = () => {
5253
mode: 'onChange',
5354
});
5455

55-
useEffectOnce(() => {
56+
const { data: flags } = flagsHooks.useFlags();
57+
58+
useEffect(() => {
59+
if (!flags) {
60+
return;
61+
}
5662
authenticationSession.logOut({
5763
userInitiated: false,
64+
federatedLoginUrl: getFederatedUrlBasedOnFlags(flags),
5865
});
59-
});
66+
}, [flags]);
6067

6168
const { data: edition } = flagsHooks.useFlag(FlagId.EDITION);
6269
const { data: showSignUpLink } = flagsHooks.useFlag(FlagId.SHOW_SIGN_UP_LINK);

packages/react-ui/src/app/interceptors.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getFederatedUrlBasedOnFlags } from '@/app/common/auth/lib/utils';
12
import { API_URL, isUrlRelative } from '@/app/lib/api';
23
import { authenticationSession } from '@/app/lib/authentication-session';
34
import axios, { AxiosError, HttpStatusCode } from 'axios';
@@ -60,12 +61,13 @@ axios.interceptors.response.use(
6061
if (url !== OPENOPS_CLOUD_USER_INFO_API_URL && !isSignInRoute) {
6162
console.warn('JWT expired logging out');
6263

63-
const flags = queryClient.getQueryData<FlagsMap>([QueryKeys.flags]);
64+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65+
const flags = queryClient.getQueryData<FlagsMap>([QueryKeys.flags])!;
6466
authenticationSession.logOut({
6567
userInitiated: false,
66-
federatedLoginUrl: flags?.FRONTEGG_URL as string | undefined,
68+
federatedLoginUrl: getFederatedUrlBasedOnFlags(flags),
6769
});
68-
if (!flags?.FRONTEGG_URL) {
70+
if (!flags?.FEDERATED_LOGIN_ENABLED) {
6971
window.location.reload();
7072
}
7173
}

packages/react-ui/src/app/routes/cloud-connection/cloud-connection-page.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ const CloudConnectionPage = () => {
6464
secure: true,
6565
expires: getExpirationDate(auth.user.accessToken),
6666
});
67-
Cookies.set('cloud-refresh-token', auth.user.refreshToken, {
68-
sameSite: 'None',
69-
secure: true,
70-
expires: getExpirationDate(auth.user.accessToken),
71-
});
7267

7368
const originProjectId =
7469
sessionStorage.getItem(ORGIN_PROJECT_ID_KEY);

packages/server/api/src/app/app-connection/app-connection.entity.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
import { EncryptedObject } from '@openops/server-shared';
2-
import { AppConnection, AppConnectionStatus, Project } from '@openops/shared';
1+
import {
2+
AppConnection,
3+
AppConnectionStatus,
4+
EncryptedObject,
5+
Project,
6+
} from '@openops/shared';
37
import { EntitySchema } from 'typeorm';
48
import {
59
BaseColumnSchemaPart,

packages/server/api/src/app/database/migrations/1759242268873-MigrateAiConfigToAppConnection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { EncryptedObject, encryptUtils, logger } from '@openops/server-shared';
1+
import { encryptUtils, logger } from '@openops/server-shared';
2+
import { EncryptedObject } from '@openops/shared';
23
import { MigrationInterface, QueryRunner } from 'typeorm';
34

45
export class MigrateAiConfigToAppConnection1759242268873

packages/server/api/src/app/flows/step-test-output/flow-step-test-output.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
compressAndEncrypt,
33
decryptAndDecompress,
4-
EncryptedObject,
54
} from '@openops/server-shared';
65
import {
6+
EncryptedObject,
77
FlowStepTestOutput,
88
FlowVersionId,
99
OpenOpsId,

packages/server/shared/src/lib/security/encrypt-compress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { FileCompression } from '@openops/shared';
1+
import { EncryptedObject, FileCompression } from '@openops/shared';
22
import { fileCompressor } from '../file-compressor';
3-
import { EncryptedObject, encryptUtils } from './encryption';
3+
import { encryptUtils } from './encryption';
44

55
/**
66
* Compress and encrypt an object

0 commit comments

Comments
 (0)