3d Slicer with Keycloak auth not working
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://
I added "user" to all monailabel groups.
I can log in via the popup.
r
I can see in Keycloak that the login is successful.
When I want to load the first image by clicking on "Next Sample"...
I get an error:
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)
Here are example values for sampleDataLogic.downloadFromUrl function:
nodeNames="spleen_19.nii.gz"
fileNames="spleen_19.nii.gz"
uris="http://
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
Could you please examine the situation to determine if I am making any mistake? Thanks
I see.. looks like a bug.. because download volume from 3d slicer utils won't pass the required auth header..
It is fixable..
@SachidanandAlle let us know if you want to get an API to pass authentication header.
Yes . That will be the right fix :)