Project-MONAI / Project-MONAI/MONAILabel

3d Slicer with Keycloak auth not working

Open
#1,493 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
891
Forks
269
Avg merge
15h 41m
Merged PRs (30d)
1

Description

I am encountering an issue while configuring Keycloak authentication for the MonaiLabel server/3D Slicer. Although Keycloak is running and I can successfully log in through the login popup in 3D Slicer (verified through Keycloak events), I encounter an error when attempting to load the first image using the "Next Sample" button. The error message states "list index out of range." Upon inspecting the code of the 3D Slicer Monai extension, it appears that there is a problem with downloading an image from the MonaiLabel server.
Here are more details:

What I used:
minailabel server docker image: projectmonai/monailabel:0.7.0
3D Slicer: 5.3.0-2023-06-27
slicer extension installed via developer mode from the up to date master branch

How I run monailabel server
export MONAI_LABEL_AUTH_REALM_URI=http://:8089/realms/monailabel
export MONAI_LABEL_AUTH_ENABLE=True
export MONAI_LABEL_AUTH_CLIENT_ID=monailabel-app
export MONAI_LABEL_AUTH_ROLE_USER=monailabel-user
monailabel start_server --app apps/radiology --studies data/datasets/Task09_Spleen/imagesTr --conf models all

I added "user" to all monailabel groups.
image
I can log in via the popup.
imager

I can see in Keycloak that the login is successful.
image
When I want to load the first image by clicking on "Next Sample"...
image
I get an error:

image
The error line in https://github.com/Project-MONAI/MONAILabel/blob/b95e498e8509f899e4e49a624cc7f050a8654cda/plugins/slicer/MONAILabel/MONAILabel.py#L1268
(my error says that the error is on line 1286, but I added some logs before the line so it is shifted)

image
Here are example values for sampleDataLogic.downloadFromUrl function:
nodeNames="spleen_19.nii.gz"
fileNames="spleen_19.nii.gz"
uris="http://:8025/datastore/image?image=spleen_19"
checksums=None

Console of monailabel server : [2023-07-17 09:42:39,952] [469] [MainThread] [INFO] (monailabel.endpoints.activelearning:60) - Next sample: {'id': 'spleen_52', 'weight': 421328, 'path': '/workspace/data/datasets/Task09_Spleen/imagesTr/spleen_52.nii.gz', 'ts': 1687437902, 'name': 'spleen_52.nii.gz', 'strategy': {'random': {'ts': 1689586959, 'client_id': 'user'}}}

Once I disable the authentication feature and restart the MonaiLabel server, everything functions as expected. I am able to successfully load an image without encountering any issues.

export MONAI_LABEL_AUTH_ENABLE=False
image

Could you please examine the situation to determine if I am making any mistake?
Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with plugins/slicer/MONAILabel/MONAILabel.py around line 1268 and inspect the sampleDataLogic.downloadFromUrl call using the reported node names, file names, URI, and checksum values. Reproduce with authentication enabled and disabled, then compare the server's activelearning “Next sample” output. Done means identifying the authenticated image-download failure and confirming that “Next Sample” loads an image with authentication enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.