From 13ca772dc7cfb63c512ef22a5b6d6881bdae4ac7 Mon Sep 17 00:00:00 2001 From: Xiao Gui Date: Wed, 11 Dec 2024 12:51:07 +0100 Subject: [PATCH] maint: update upload URL feat: oauth redirect url --- .helm/instances/voluba-prod/ebrains/create.sh | 11 +++++++++++ backend/voluba_backend/voluba_auth.py | 5 ++++- backend/voluba_backend/voluba_config.py | 2 +- frontend/src/app/app.module.ts | 2 +- frontend/src/const.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 .helm/instances/voluba-prod/ebrains/create.sh diff --git a/.helm/instances/voluba-prod/ebrains/create.sh b/.helm/instances/voluba-prod/ebrains/create.sh new file mode 100755 index 00000000..d1366162 --- /dev/null +++ b/.helm/instances/voluba-prod/ebrains/create.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +hosts='[{"host": "voluba.apps.ebrains.eu", "paths": [{ "path": "/", "pathType": "Prefix" }]}]' +tls='[{"secretName": "voluba-prod-ebrains-cert-secret", "hosts": ["voluba.apps.ebrains.eu"]}]' + +helm install \ + voluba-prod-ebrains \ + .helm/voluba-prod/ \ + --set env.HOSTNAME=https://voluba.apps.ebrains.eu \ + --set-json ingress.hosts="$hosts" \ + --set-json ingress.tls="$tls" diff --git a/backend/voluba_backend/voluba_auth.py b/backend/voluba_backend/voluba_auth.py index f7c49b73..aa456995 100644 --- a/backend/voluba_backend/voluba_auth.py +++ b/backend/voluba_backend/voluba_auth.py @@ -62,7 +62,10 @@ async def login_via_ebrains(request: Request, state: str = None): kwargs = {} if state: kwargs["state"] = state - return await oauth.ebrains.authorize_redirect(request, redirect_uri=voluba_config.EBRAINS_IAM_REDIRECT_URL, **kwargs) + + base_url = str(request.base_url).replace("http://", "https://", 1) + redirect_uri = base_url.rstrip("/") + "/hbp-oidc-v2/cb" + return await oauth.ebrains.authorize_redirect(request, redirect_uri=voluba_config.EBRAINS_IAM_REDIRECT_URL or redirect_uri, **kwargs) @router.get("/hbp-oidc-v2/cb") async def ebrains_callback(request: Request): diff --git a/backend/voluba_backend/voluba_config.py b/backend/voluba_backend/voluba_config.py index 05198a82..f93f3549 100644 --- a/backend/voluba_backend/voluba_config.py +++ b/backend/voluba_backend/voluba_config.py @@ -4,7 +4,7 @@ EBRAINS_IAM_CLIENT_ID = os.getenv("HBP_V2_CLIENTID") EBRAINS_IAM_CLIENT_SECRET = os.getenv("HBP_V2_CLIENTSECRET") EBRAINS_IAM_DISCOVERY_URL = 'https://iam.ebrains.eu/auth/realms/hbp' -EBRAINS_IAM_REDIRECT_URL = f"{HOSTNAME}/hbp-oidc-v2/cb" +EBRAINS_IAM_REDIRECT_URL = os.getenv("EBRAINS_IAM_REDIRECT_URL") EBRAINS_IAM_SCOPE = os.getenv("HBP_V2_SCOPE", 'openid email profile collab.drive') EBRAINS_SA_CLIENT_ID = os.getenv("EBRAINS_SA_CLIENT_ID") diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 8170f054..3553c8c0 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -68,7 +68,7 @@ import { Subject, debounceTime, map, merge, shareReplay } from 'rxjs'; { provide: VOLUBA_APP_CONFIG, useValue: { - uploadUrl: "https://zam10143.zam.kfa-juelich.de/chumni", + uploadUrl: "https://zam12230.jsc.fz-juelich.de/bespoke-volis/", linearBackend: "https://voluba-backend.apps.tc.humanbrainproject.eu", sxplrhost: "https://atlases.ebrains.eu/viewer" } as VolubaAppConfig diff --git a/frontend/src/const.ts b/frontend/src/const.ts index 50d94b50..fcf3c8bc 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -428,7 +428,7 @@ export type ZarrAttrs = { version: string axes: { name: "x" | "y" | "z" | string - type: "space" | string + type: "space" | "channel" | string unit: "micrometer" | string }[] datasets: {