changeset 238:9d91c7f0c204

/tokens/decode now returns the list of resources in the token
author Alain Mazy <am@orthanc.team>
date Tue, 10 Jun 2025 17:24:59 +0200
parents 855640287178
children e878945f519e 1877694ab4f7
files NEWS Plugin/Plugin.cpp
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon May 26 19:37:53 2025 +0200
+++ b/NEWS	Tue Jun 10 17:24:59 2025 +0200
@@ -6,6 +6,9 @@
 => Minimum SDK version: 1.11.3 <=
 
 * New default permissions to Q&R remote modalities
+* The /tokens/decode route now returns 2 additionnal fields:
+  "ResourcesDicomIds" and "ResourcesOrthancIds".
+  This will only work if the authorization service returns a "resources" field to the /tokens/decode route.
 * Maintenance: Use Orthanc SDK 1.12.4 by default to benefit from more detailed logging.
 * Fix default permission for /dicom-web/servers/../stow
 * When calling /dicom-web/studies with a resource token when no StudyInstanceUID 
--- a/Plugin/Plugin.cpp	Mon May 26 19:37:53 2025 +0200
+++ b/Plugin/Plugin.cpp	Tue Jun 10 17:24:59 2025 +0200
@@ -1182,6 +1182,18 @@
         decodedJsonToken["TokenType"] = decodedToken.tokenType;
       }
 
+      decodedJsonToken["ResourcesDicomIds"] = Json::arrayValue;
+      for (std::set<std::string>::const_iterator it = decodedToken.resourcesDicomIds.begin(); it != decodedToken.resourcesDicomIds.end(); ++it)
+      {
+        decodedJsonToken["ResourcesDicomIds"].append(*it);
+      }
+
+      decodedJsonToken["ResourcesOrthancIds"] = Json::arrayValue;
+      for (std::set<std::string>::const_iterator it = decodedToken.resourcesOrthancIds.begin(); it != decodedToken.resourcesOrthancIds.end(); ++it)
+      {
+        decodedJsonToken["ResourcesOrthancIds"].append(*it);
+      }
+
       OrthancPlugins::AnswerJson(decodedJsonToken, output);
     }
   }