Mercurial > hg > orthanc-education
changeset 92:cb207fadb7dd
renamed some LTI routes for clarity
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Thu, 30 Jul 2026 18:17:19 +0200 |
| parents | c98502a806f2 |
| children | 07e6100a3ea3 |
| files | Sources/LTI/LTIRoutes.cpp WebApplication/deep.js |
| diffstat | 2 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/Sources/LTI/LTIRoutes.cpp Thu Jul 30 18:03:07 2026 +0200 +++ b/Sources/LTI/LTIRoutes.cpp Thu Jul 30 18:17:19 2026 +0200 @@ -272,7 +272,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } - // The info below is copied by "deep.js", then sent to "CreateDeepLink()" or "RedirectToViewer()" + // The info below is copied by "deep.js", then sent to "DeepLinkCreate()" or "DeepLinkTestViewer()" Json::Value info; info["aud"] = Orthanc::SerializationToolbox::ReadString(payload, "iss"); @@ -326,7 +326,7 @@ } -void CreateDeepLink(OrthancPluginRestOutput* output, +void DeepLinkCreate(OrthancPluginRestOutput* output, const std::string& url, const OrthancPluginHttpRequest* request, const AuthenticatedUser& user) @@ -400,10 +400,10 @@ -void RedirectToViewer(OrthancPluginRestOutput* output, - const std::string& url, - const OrthancPluginHttpRequest* request, - const AuthenticatedUser& user) +void DeepLinkTestViewer(OrthancPluginRestOutput* output, + const std::string& url, + const OrthancPluginHttpRequest* request, + const AuthenticatedUser& user) { if (request->method != OrthancPluginHttpMethod_Get) { @@ -421,7 +421,7 @@ std::unique_ptr<AuthenticatedUser> check(AuthenticatedUser::FromJWT(EducationConfiguration::GetInstance().GetLtiContext(), bearer->second)); CheckUserPermission(args, *check); - // Setting the cookie is needed for "RedirectToViewer()" to work, as long as no deep link has been created + // Setting the cookie is needed for "DeepLinkTestViewer()" to work, as long as no deep link has been created { const bool secureCookies = EducationConfiguration::GetInstance().IsSecureCookies(); HttpToolbox::SetCookie(output, COOKIE_LTI, bearer->second, CookieSameSite_Lax, secureCookies); @@ -442,10 +442,10 @@ } -void ListProjectResourcesForLti(OrthancPluginRestOutput* output, - const std::string& url, - const OrthancPluginHttpRequest* request, - const AuthenticatedUser& user) +void DeepLinkListProjectResources(OrthancPluginRestOutput* output, + const std::string& url, + const OrthancPluginHttpRequest* request, + const AuthenticatedUser& user) { if (user.GetRole() == Role_Administrator) { @@ -610,10 +610,10 @@ RestApiRouter::RegisterPublicGetRoute<ServeRegister>("/education/lti/register"); RestApiRouter::RegisterPublicRoute<ServeOidc>("/education/lti/oidc"); - // Those are sensitive routes that must be protected inside the callback - RestApiRouter::RegisterAuthenticatedRoute<CreateDeepLink>("/education/lti/create-deep-link"); - RestApiRouter::RegisterAuthenticatedRoute<RedirectToViewer>("/education/lti/open-viewer"); - RestApiRouter::RegisterAuthenticatedGetRoute<ListProjectResourcesForLti>("/education/lti/project-resources"); + // Sensitive routes used during deep link creation, they must be protected inside the callback + RestApiRouter::RegisterAuthenticatedRoute<DeepLinkCreate>("/education/lti/deep-link-create"); + RestApiRouter::RegisterAuthenticatedRoute<DeepLinkTestViewer>("/education/lti/deep-link-test-viewer"); + RestApiRouter::RegisterAuthenticatedGetRoute<DeepLinkListProjectResources>("/education/lti/deep-link-project-resources"); // Sensitive routes responsible for LTI authentication, they occur // after "/education/lti/oidc" and they must be protected using
--- a/WebApplication/deep.js Thu Jul 30 18:03:07 2026 +0200 +++ b/WebApplication/deep.js Thu Jul 30 18:17:19 2026 +0200 @@ -73,7 +73,7 @@ reloadProject: function() { var that = this; - axios.get('project-resources', { + axios.get('deep-link-project-resources', { headers: { 'Authorization': 'Bearer ' + this.info['orthanc-education-jwt'] } @@ -109,7 +109,7 @@ linkResource: function(resource) { var that = this; - axios.post('create-deep-link', this.getDeepLinkParams(resource, true, false), + axios.post('deep-link-create', this.getDeepLinkParams(resource, true, false), { // Security information that is managed by the Orthanc LTI plugin headers: { @@ -130,7 +130,7 @@ }, openViewer: function(resource) { - url = 'open-viewer?' + this.getDeepLinkParams(resource, false, true).toString(); + url = 'deep-link-test-viewer?' + this.getDeepLinkParams(resource, false, true).toString(); window.open(url, '_blank').focus(); }, @@ -145,7 +145,7 @@ params.append('nonce', this.info['nonce']); var that = this; - axios.post('create-deep-link', params, + axios.post('deep-link-create', params, { // Security information that is managed by the Orthanc LTI plugin headers: {
