Hello,
I have a plugin that defines a xapi endpoint (e.g. localhost:8080/xnat/xapi/test) to retrieve some information from another platform. Also, I'm using the openid plugin for auth in XNAT (the other platform uses the same method).
The main idea is that the user logins with openid to the external platform, and then this platform sends API requests to the plugin xapi endpoint (which will include the Authorization Bearer token) to retrieve some info.
So, what I want to do is:
1) Send GET request to the API endpoint, with Authorization Bearer header containing the oidc token
2) In the API, process the request, extract the token and get the user related to that token (through naming pattern with sub). I believe this can be done with Users.getUserManagementService().getUser(userIdentifier) from org.nrg.xdat.security.helpers.Users
3) Use the extracted user for further processing and information extraction
Actually, the step about retrieving the user is optional I think, I just want to validate the authorization with the token and not a signed-in xnat user (i.e. JSESSIONID or similar).
I have implemented this functionality in the plugin. However, I'm finding that the xapi is protected by XNAT user auth as I get a HTTP 401 Unauthorized. The only way I have found to get through is by:
1) Using Authorization Basic header with username:password encoded in base64. This is not suitable for my case since we're using openid (and for security concerns).
2) Use an Alias Token, but I would like a more straightforward process that doesn't involve the user copy-pasting the token into the platform sending the API requests and having to refresh this every time it expires.
Is there any way to disable the XNAT user auth from this specific xapi endpoint so that authorization can be done through a oidc token?
Sorry for the long post.