Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(token-vault): removing /sessions endpoint from interception #365

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions e2e/token-vault-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"targets": {
"build": {
"executor": "@nx/vite:build",
"dependsOn": ["token-vault-app:build-interceptor"],
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
Expand All @@ -22,6 +23,15 @@
}
}
},
"build-interceptor": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
"configFile": "e2e/token-vault-app/vite.interceptor.config.ts",
"emptyOutDir": false,
"outputPath": "e2e/token-vault-app/public/"
}
},
"serve": {
"executor": "@nx/vite:dev-server",
"dependsOn": ["token-vault-app:build"],
Expand Down
17 changes: 3 additions & 14 deletions e2e/token-vault-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import viteTsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
build: {
minify: false,
rollupOptions: {
input: {
interceptor: 'e2e/token-vault-app/src/interceptor.ts',
main: 'e2e/token-vault-app/src/main.ts',
main: './e2e/token-vault-app/src/main.ts',
},
output: {
// dir: 'e2e/token-vault-app/public',
entryFileNames: '[name].js',
entryFileNames: 'main.js',
},
},
},
Expand All @@ -23,19 +22,9 @@ export default defineConfig({
},
strictPort: true,
},

plugins: [
viteTsConfigPaths({
root: '../../',
}),
],

worker: {
plugins: [
viteTsConfigPaths({
root: '../../',
}),
],
format: 'es',
},
});
22 changes: 22 additions & 0 deletions e2e/token-vault-app/vite.interceptor.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from 'vite';
import viteTsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
plugins: [
viteTsConfigPaths({
root: '../../',
}),
],
build: {
minify: false,
emptyOutDir: false,
rollupOptions: {
input: 'e2e/token-vault-app/src/interceptor.ts',
output: {
entryFileNames: 'interceptor.js',
format: 'iife',
esModule: false,
},
},
},
});
1 change: 1 addition & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"options": {
"cacheableOperations": [
"build",
"build-interceptor",
"build-types",
"bundle-types",
"test",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"start:angular-todo": "nx run angular-todo:config && nx run-many --target=serve --projects=angular-todo,todo-api",
"start:server": "nx run mock-api:serve",
"start:server:live": "NODE_ENV=LIVE nx run mock-api:serve:live",
"start:token-vault": "nx run-many --target=serve --projects=token-vault-app,token-vault-proxy,mock-api",
"test": "npm run test:unit && npm run test:integration && npm run test:e2e",
"test:e2e": "nx affected:e2e --parallel 1 --max-parallel 1",
"test:e2e:live": "nx run autoscript-suites:e2e --configuration=live",
Expand Down
2 changes: 0 additions & 2 deletions shared/workers/src/lib/worker.utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ test('generateUrlsToIntercept returns the expected array of URLs', () => {
'https://openam.forgerock.com/am/oauth2/realms/root/connect/endSession?',
'https://openam.forgerock.com/am/oauth2/realms/root/token/revoke',
'https://openam.forgerock.com/am/oauth2/realms/root/userinfo',
'https://openam.forgerock.com/am/json/realms/root/sessions',
];

expect(generateUrlsToIntercept(config)).toEqual(expectedUrls);
Expand All @@ -48,7 +47,6 @@ test('generateUrlsToIntercept returns the expected array of URLs with /alpha as
'https://openam.forgerock.com/am/oauth2/realms/root/realms/alpha/connect/endSession?',
'https://openam.forgerock.com/am/oauth2/realms/root/realms/alpha/token/revoke',
'https://openam.forgerock.com/am/oauth2/realms/root/realms/alpha/userinfo',
'https://openam.forgerock.com/am/json/realms/root/realms/alpha/sessions',
];

expect(generateUrlsToIntercept(config)).toEqual(expectedUrls);
Expand Down
1 change: 0 additions & 1 deletion shared/workers/src/lib/worker.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function generateUrlsToIntercept(config: InterceptorConfig) {
`${resolveUrl(forgerockBaseUrl, getEndpointPath('endSession', realmPath))}?`,
`${resolveUrl(forgerockBaseUrl, getEndpointPath('revoke', realmPath))}`,
`${resolveUrl(forgerockBaseUrl, getEndpointPath('userInfo', realmPath))}`,
`${resolveUrl(forgerockBaseUrl, getEndpointPath('sessions', realmPath))}`,
];
return urls;
}
Expand Down
Loading