mirror of https://github.com/boxyhq/jackson.git
Compare commits
19 Commits
00037b86f2
...
c34684179d
Author | SHA1 | Date |
---|---|---|
Aswin V | c34684179d | |
Aswin V | 5d800b1ca9 | |
Aswin V | f6479c900e | |
Aswin V | 4e2fe03131 | |
Deepak Prabhakara | 63baf12a38 | |
Deepak Prabhakara | 668a1ba499 | |
Deepak Prabhakara | b6adc308f7 | |
dependabot[bot] | bbcea282f8 | |
dependabot[bot] | 143ab81eea | |
dependabot[bot] | 14e222163c | |
dependabot[bot] | 571a2d1f0f | |
dependabot[bot] | a6e993d1c8 | |
dependabot[bot] | bd2dc3d382 | |
dependabot[bot] | de83010f93 | |
dependabot[bot] | 6f14494078 | |
dependabot[bot] | 71f5a31e0b | |
dependabot[bot] | 7fd15f5b7b | |
dependabot[bot] | c0737a20bc | |
dependabot[bot] | f3efcdd2ce |
|
@ -5,6 +5,14 @@ export class Portal {
|
|||
constructor(public readonly page: Page) {
|
||||
this.userAvatarLocator = this.page.getByTestId('user-avatar');
|
||||
}
|
||||
|
||||
async doCredentialsLogin() {
|
||||
await this.page.goto('/admin/auth/login');
|
||||
await this.page.getByPlaceholder('Email').fill('super@boxyhq.com');
|
||||
await this.page.getByPlaceholder('Password').fill('999login');
|
||||
await this.page.getByRole('button', { name: 'Sign In' }).click();
|
||||
}
|
||||
|
||||
async isLoggedIn() {
|
||||
// assert login state
|
||||
await expect(this.userAvatarLocator).toBeVisible();
|
||||
|
|
|
@ -7,24 +7,27 @@ type MyFixtures = {
|
|||
};
|
||||
|
||||
export const test = baseTest.extend<MyFixtures>({
|
||||
ssoPage: async ({ page, baseURL }, use, testInfo) => {
|
||||
const ssoPage = new SSOPage(page);
|
||||
const ssoName = `saml-${testInfo.workerIndex}`;
|
||||
await ssoPage.goto();
|
||||
await ssoPage.addSSOConnection({ name: ssoName, type: 'saml', baseURL: baseURL! });
|
||||
await use(ssoPage);
|
||||
},
|
||||
portal: async ({ page }, use) => {
|
||||
const portal = new Portal(page);
|
||||
await use(portal);
|
||||
},
|
||||
ssoPage: async ({ page, portal }, use) => {
|
||||
const ssoPage = new SSOPage(page);
|
||||
await ssoPage.goto();
|
||||
await use(ssoPage);
|
||||
await portal.doCredentialsLogin();
|
||||
await portal.isLoggedIn();
|
||||
await ssoPage.deleteAllSSOConnections();
|
||||
},
|
||||
});
|
||||
|
||||
test('OAuth2 wrapper + SAML provider + wrong redirectUrl', async ({ ssoPage, page, baseURL }, testInfo) => {
|
||||
const ssoName = `saml-${testInfo.workerIndex}`;
|
||||
await ssoPage.addSSOConnection({ name: ssoName, type: 'saml', baseURL: baseURL! });
|
||||
// check if the first added connection appears in the connection list
|
||||
await expect(page.getByText(`saml-${testInfo.workerIndex}-1`)).toBeVisible();
|
||||
await expect(page.getByText(`${ssoName}-1`)).toBeVisible();
|
||||
await ssoPage.updateSSOConnection({
|
||||
name: `saml-${testInfo.workerIndex}-1`,
|
||||
name: `${ssoName}-1`,
|
||||
url: 'https://invalid-url.com',
|
||||
});
|
||||
// Logout of magic link login
|
||||
|
@ -37,17 +40,18 @@ test('OAuth2 wrapper + SAML provider + wrong redirectUrl', async ({ ssoPage, pag
|
|||
});
|
||||
|
||||
test('OAuth2 wrapper + SAML provider + inactive connection', async ({ ssoPage, page, baseURL }, testInfo) => {
|
||||
const ssoName = `saml-${testInfo.workerIndex}`;
|
||||
await ssoPage.addSSOConnection({ name: ssoName, type: 'saml', baseURL: baseURL! });
|
||||
// check if the first added connection appears in the connection list
|
||||
const ssoName = `saml-${testInfo.workerIndex}-1`;
|
||||
await expect(page.getByText(ssoName)).toBeVisible();
|
||||
await expect(page.getByText(`${ssoName}-1`)).toBeVisible();
|
||||
await ssoPage.updateSSOConnection({
|
||||
name: ssoName,
|
||||
name: `${ssoName}-1`,
|
||||
url: baseURL!,
|
||||
newStatus: false,
|
||||
});
|
||||
// Confirm connection label inactive is displayed
|
||||
await expect(
|
||||
page.getByText(ssoName).locator('xpath=..').getByRole('cell', { name: 'Inactive', exact: true })
|
||||
page.getByText(`${ssoName}-1`).locator('xpath=..').getByRole('cell', { name: 'Inactive', exact: true })
|
||||
).toBeVisible();
|
||||
// Logout and try to sign in with connection
|
||||
// Logout of magic link login
|
||||
|
@ -62,13 +66,12 @@ test('OAuth2 wrapper + SAML provider + inactive connection', async ({ ssoPage, p
|
|||
});
|
||||
|
||||
test('OAuth2 wrapper + OIDC provider + wrong redirectUrl', async ({ ssoPage, page, baseURL }, testInfo) => {
|
||||
await ssoPage.deleteAllSSOConnections(); // should delete the saml connection from the fixture
|
||||
const ssoName = `oidc-${testInfo.workerIndex}`;
|
||||
await ssoPage.addSSOConnection({ name: ssoName, type: 'oidc', baseURL: baseURL! });
|
||||
// check if the oidc connection appears in the connection list
|
||||
await expect(page.getByText(ssoName)).toBeVisible();
|
||||
await expect(page.getByText(`${ssoName}-1`)).toBeVisible();
|
||||
await ssoPage.updateSSOConnection({
|
||||
name: ssoName,
|
||||
name: `${ssoName}-1`,
|
||||
url: 'https://invalid-url.com',
|
||||
});
|
||||
// Logout of magic link login
|
||||
|
@ -81,19 +84,18 @@ test('OAuth2 wrapper + OIDC provider + wrong redirectUrl', async ({ ssoPage, pag
|
|||
});
|
||||
|
||||
test('OAuth2 wrapper + OIDC provider + inactive connection', async ({ ssoPage, page, baseURL }, testInfo) => {
|
||||
await ssoPage.deleteAllSSOConnections(); // should delete the sso connections from the fixture and prev test
|
||||
const ssoName = `oidc-${testInfo.workerIndex}`;
|
||||
await ssoPage.addSSOConnection({ name: ssoName, type: 'oidc', baseURL: baseURL! });
|
||||
// check if the oidc connection appears in the connection list
|
||||
await expect(page.getByText(ssoName)).toBeVisible();
|
||||
await expect(page.getByText(`${ssoName}-1`)).toBeVisible();
|
||||
await ssoPage.updateSSOConnection({
|
||||
name: ssoName,
|
||||
name: `${ssoName}-1`,
|
||||
url: baseURL!,
|
||||
newStatus: false,
|
||||
});
|
||||
// Confirm connection label inactive is displayed
|
||||
await expect(
|
||||
page.getByText(ssoName).locator('xpath=..').getByRole('cell', { name: 'Inactive', exact: true })
|
||||
page.getByText(`${ssoName}-1`).locator('xpath=..').getByRole('cell', { name: 'Inactive', exact: true })
|
||||
).toBeVisible();
|
||||
// Logout and try to sign in with connection
|
||||
// Logout of magic link login
|
||||
|
@ -106,10 +108,3 @@ test('OAuth2 wrapper + OIDC provider + inactive connection', async ({ ssoPage, p
|
|||
page.getByText('SSO error: SSO connection is deactivated. Please contact your administrator.')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
// below is a hack, TODO: use proper cleanup mechanism afterAll hook to remove the SSO from the last test in this file
|
||||
test('cleanup', async ({ ssoPage }) => {
|
||||
await ssoPage.deleteAllSSOConnections();
|
||||
});
|
||||
|
||||
// test.afterAll(())
|
||||
|
|
|
@ -36,7 +36,7 @@ test('OAuth2 wrapper + SAML provider + OIDC provider', async ({
|
|||
await expect(page.getByText(`oidc-${testInfo.workerIndex}-2`)).toBeVisible();
|
||||
// Logout of magic link login
|
||||
await ssoPage.logout();
|
||||
// Login using MockLab
|
||||
// Login using MockSAML
|
||||
await ssoPage.signInWithSSO();
|
||||
// Select IdP from selection screen
|
||||
await ssoPage.selectIdP(`saml-${testInfo.workerIndex}-1`);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -39,19 +39,19 @@
|
|||
"coverage-map": "map.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-dynamodb": "3.568.0",
|
||||
"@aws-sdk/credential-providers": "3.567.0",
|
||||
"@aws-sdk/util-dynamodb": "3.567.0",
|
||||
"@aws-sdk/client-dynamodb": "3.569.0",
|
||||
"@aws-sdk/credential-providers": "3.569.0",
|
||||
"@aws-sdk/util-dynamodb": "3.569.0",
|
||||
"@boxyhq/error-code-mnemonic": "0.1.1",
|
||||
"@boxyhq/metrics": "0.2.6",
|
||||
"@boxyhq/saml20": "1.5.0",
|
||||
"@googleapis/admin": "17.1.0",
|
||||
"@boxyhq/metrics": "0.2.7",
|
||||
"@boxyhq/saml20": "1.5.1",
|
||||
"@googleapis/admin": "18.0.0",
|
||||
"axios": "1.6.8",
|
||||
"encoding": "0.1.13",
|
||||
"jose": "5.2.4",
|
||||
"lodash": "4.17.21",
|
||||
"mixpanel": "0.18.0",
|
||||
"mongodb": "6.5.0",
|
||||
"mongodb": "6.6.0",
|
||||
"mssql": "10.0.2",
|
||||
"mysql2": "3.9.7",
|
||||
"node-forge": "1.3.1",
|
||||
|
@ -64,7 +64,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "8.4.1",
|
||||
"@types/lodash": "4.17.0",
|
||||
"@types/lodash": "4.17.1",
|
||||
"@types/node": "20.12.8",
|
||||
"@types/sinon": "17.0.3",
|
||||
"@types/tap": "15.0.11",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jackson",
|
||||
"version": "1.23.6",
|
||||
"version": "1.23.7",
|
||||
"private": true,
|
||||
"description": "SAML 2.0 service",
|
||||
"keywords": [
|
||||
|
@ -66,8 +66,8 @@
|
|||
"@boxyhq/react-ui": "3.3.43",
|
||||
"@boxyhq/saml-jackson": "file:npm",
|
||||
"@heroicons/react": "2.1.3",
|
||||
"@retracedhq/logs-viewer": "2.7.3",
|
||||
"@retracedhq/retraced": "0.7.9",
|
||||
"@retracedhq/logs-viewer": "2.7.4",
|
||||
"@retracedhq/retraced": "0.7.10",
|
||||
"@tailwindcss/typography": "0.5.13",
|
||||
"axios": "1.6.8",
|
||||
"blockly": "10.4.3",
|
||||
|
|
|
@ -20,15 +20,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
}
|
||||
|
||||
const handleGET = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const { connectionAPIController, directorySyncController } = await jackson();
|
||||
const { connectionAPIController, directorySyncController, samlFederatedController } = await jackson();
|
||||
|
||||
const sso_connections_count = await connectionAPIController.getCount();
|
||||
const dsync_connections_count = await directorySyncController.directories.getCount();
|
||||
const identity_federation_count = await samlFederatedController.app.getCount();
|
||||
|
||||
return res.json({
|
||||
data: {
|
||||
sso_connections: sso_connections_count,
|
||||
dsync_connections: dsync_connections_count,
|
||||
identity_federation_apps: identity_federation_count,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||
// Get counts for product
|
||||
let sso_connections_count = 0;
|
||||
let dsync_connections_count = 0;
|
||||
let saml_federation_count = 0;
|
||||
let identity_federation_count = 0;
|
||||
|
||||
for (const product of products) {
|
||||
if (product) {
|
||||
|
@ -60,7 +60,7 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||
name: IndexNames.Product,
|
||||
value: product,
|
||||
});
|
||||
saml_federation_count += count || 0;
|
||||
identity_federation_count += count || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||
data: {
|
||||
sso_connections: sso_connections_count,
|
||||
dsync_connections: dsync_connections_count,
|
||||
saml_federation: saml_federation_count,
|
||||
identity_federation_apps: identity_federation_count,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ const config: PlaywrightTestConfig = {
|
|||
reuseExistingServer: !process.env.CI,
|
||||
env: {
|
||||
DEBUG: 'pw:webserver',
|
||||
NEXTAUTH_ADMIN_CREDENTIALS: 'super@boxyhq.com:999login',
|
||||
},
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue