Skip to content

Commit 3e81fe6

Browse files
authored
Merge pull request #852 from fractal-analytics-platform/851-adapt-to-new-oauth-related-env-variables
Adapt to new backend OAuth variables
2 parents 294240e + d0fc696 commit 3e81fe6

File tree

6 files changed

+25
-17
lines changed

6 files changed

+25
-17
lines changed

.github/workflows/end_to_end_tests.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
timeout-minutes: 20
1414

1515
env:
16-
OAUTH_DEXIDP_CLIENT_ID: client_test_web_id
17-
OAUTH_DEXIDP_CLIENT_SECRET: client_test_web_secret
18-
OAUTH_DEXIDP_REDIRECT_URL: "http://localhost:5173/auth/login/oauth2/"
19-
OAUTH_DEXIDP_OIDC_CONFIGURATION_ENDPOINT: "http://127.0.0.1:5556/dex/.well-known/openid-configuration"
16+
OAUTH_CLIENT_NAME: dexidp
17+
OAUTH_CLIENT_ID: client_test_web_id
18+
OAUTH_CLIENT_SECRET: client_test_web_secret
19+
OAUTH_REDIRECT_URL: "http://localhost:5173/auth/login/oauth2/"
20+
OAUTH_OIDC_CONFIG_ENDPOINT: "http://127.0.0.1:5556/dex/.well-known/openid-configuration"
2021
PUBLIC_OAUTH_CLIENT_NAME: dexidp
2122
PUBLIC_FRACTAL_DATA_URL: http://localhost:3000/data
2223
PUBLIC_FRACTAL_VIZARR_VIEWER_URL: http://localhost:3000/data/vizarr

docs/development/tests.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ To skip Pixi test set the environment variable `SKIP_PIXI_TEST` to `true`.
2525
To run the OAuth2 test locally add the following configuration to `.fractal_server.env`:
2626

2727
```
28-
OAUTH_DEXIDP_CLIENT_ID=client_test_web_id
29-
OAUTH_DEXIDP_CLIENT_SECRET=client_test_web_secret
30-
OAUTH_DEXIDP_REDIRECT_URL=http://localhost:5173/auth/login/oauth2/
31-
OAUTH_DEXIDP_OIDC_CONFIGURATION_ENDPOINT=http://127.0.0.1:5556/dex/.well-known/openid-configuration
28+
OAUTH_CLIENT_NAME=dexidp
29+
OAUTH_CLIENT_ID=client_test_web_id
30+
OAUTH_CLIENT_SECRET=client_test_web_secret
31+
OAUTH_REDIRECT_URL=http://localhost:5173/auth/login/oauth2/
32+
OAUTH_OIDC_CONFIG_ENDPOINT=http://127.0.0.1:5556/dex/.well-known/openid-configuration
3233
```
3334

3435
And then start the test IdP container:

docs/oauth2.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ This variable has to match the client name defined in fractal-server configurati
2222
* Authorization callback URL: http://127.0.0.1:5173/auth/login/oauth2/
2323
2. Set up the following env variables for fractal-server:
2424
```
25-
OAUTH_GITHUB_CLIENT_ID=...
26-
OAUTH_GITHUB_CLIENT_SECRET=...
27-
OAUTH_GITHUB_REDIRECT_URL=http://127.0.0.1:5173/auth/login/oauth2/
25+
OAUTH_CLIENT_NAME=github
26+
OAUTH_CLIENT_ID=...
27+
OAUTH_CLIENT_SECRET=...
28+
OAUTH_REDIRECT_URL=http://127.0.0.1:5173/auth/login/oauth2/
2829
# [all other variables]
2930
```
3031
3. Set up the following env variables for fractal-web:

src/routes/v2/admin/settings/+page.server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ export async function load({ fetch }) {
99
const appSettings = await listSettings(fetch, 'app');
1010
const databaseSettings = await listSettings(fetch, 'database');
1111
const emailSettings = await listSettings(fetch, 'email');
12+
const oauthSettings = await listSettings(fetch, 'oauth');
1213

1314
return {
1415
appSettings,
1516
databaseSettings,
16-
emailSettings
17+
emailSettings,
18+
oauthSettings
1719
};
1820
}

src/routes/v2/admin/settings/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
const appSettings = $derived(page.data.appSettings);
55
const databaseSettings = $derived(page.data.databaseSettings);
66
const emailSettings = $derived(page.data.emailSettings);
7+
const oauthSettings = $derived(page.data.oauthSettings);
78
89
let showObfuscated = $state(false);
910
1011
const settings = $derived([
1112
['App settings', appSettings],
1213
['Database settings', databaseSettings],
13-
['E-mail settings', emailSettings]
14+
['E-mail settings', emailSettings],
15+
['OAuth settings', oauthSettings]
1416
]);
1517
</script>
1618

tests/start-test-server.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ if [ ! -d "$fractal_server_test_path" ]; then
3434
cp "$(pwd)/tests/resource.json" "$fractal_server_test_path"
3535

3636
if [ "$SKIP_OAUTH_TEST" != "true" ]; then
37-
echo "\nOAUTH_DEXIDP_CLIENT_ID=client_test_web_id" >> "${fractal_server_test_path}/.fractal_server.env"
38-
echo "OAUTH_DEXIDP_CLIENT_SECRET=client_test_web_secret" >> "${fractal_server_test_path}/.fractal_server.env"
39-
echo "OAUTH_DEXIDP_REDIRECT_URL=http://localhost:5173/auth/login/oauth2/" >> "${fractal_server_test_path}/.fractal_server.env"
40-
echo "OAUTH_DEXIDP_OIDC_CONFIGURATION_ENDPOINT=http://127.0.0.1:5556/dex/.well-known/openid-configuration" >> "${fractal_server_test_path}/.fractal_server.env"
37+
echo "\nOAUTH_CLIENT_NAME=dexidp" >> "${fractal_server_test_path}/.fractal_server.env"
38+
echo "OAUTH_CLIENT_ID=client_test_web_id" >> "${fractal_server_test_path}/.fractal_server.env"
39+
echo "OAUTH_CLIENT_SECRET=client_test_web_secret" >> "${fractal_server_test_path}/.fractal_server.env"
40+
echo "OAUTH_REDIRECT_URL=http://localhost:5173/auth/login/oauth2/" >> "${fractal_server_test_path}/.fractal_server.env"
41+
echo "OAUTH_OIDC_CONFIG_ENDPOINT=http://127.0.0.1:5556/dex/.well-known/openid-configuration" >> "${fractal_server_test_path}/.fractal_server.env"
4142
fi
4243

4344
cd "$fractal_server_test_path"

0 commit comments

Comments
 (0)