diff --git a/classes/OpenXdmod/Migration/Version851To870/ConfigFilesMigration.php b/classes/OpenXdmod/Migration/Version851To870/ConfigFilesMigration.php deleted file mode 100644 index 798adef7ed..0000000000 --- a/classes/OpenXdmod/Migration/Version851To870/ConfigFilesMigration.php +++ /dev/null @@ -1,25 +0,0 @@ -assertPortalSettingsIsWritable(); - $this->writePortalSettingsFile( - array( - 'cors_domains' => '' - ) - ); - } -} diff --git a/classes/OpenXdmod/Migration/Version851To900/ConfigFilesMigration.php b/classes/OpenXdmod/Migration/Version851To900/ConfigFilesMigration.php index a2a07263c6..1e004f8ab1 100644 --- a/classes/OpenXdmod/Migration/Version851To900/ConfigFilesMigration.php +++ b/classes/OpenXdmod/Migration/Version851To900/ConfigFilesMigration.php @@ -22,7 +22,8 @@ public function execute() } $this->writePortalSettingsFile( array( - 'roadmap_url' => $roadmapUrl + 'roadmap_url' => $roadmapUrl, + 'cors_domains' => '' ) ); diff --git a/docs/integrations.md b/docs/integrations.md index e8fe6097f3..ab3c9036fd 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -11,14 +11,14 @@ The Open XDMoD application settings to enabled this are described below. To allow CORS a list of domains that are allowed to communicate with Open XDMoD is configured in the `domains` setting in the `cors` section of `portal_settings.ini`. -This setting is a comma separated list where each item contains the scheme, host, and optional port. +This setting is a comma separated list where each item matches *exactly* what is in the `Origin` header sent by the browser. +This includes the schema, host, and non standard ports. ``` [cors] domains=https://integratedapp.example.tld,https://dev-integratedapp.example.tld:8080 ``` -**NOTE: This setting can open up Open XDMoD to security risks if used improperly. -Only enable it if you know what you are doing** +**NOTE: This setting can open up Open XDMoD to security risks if used improperly.** ## Integration Guide @@ -30,23 +30,63 @@ iframe at the login endpoint and iusers will be automatically logged in. When Open XDMoD detects a login within an iframe it will send a `postMessage` to `window.top` -The following is an example of how to handle this +The application that is integrating with Open XDMoD should contain a page *like* the following: -```javascript -window.addEventListener("message", receiveMessage, false); - -function receiveMessage(event) { - if (event.origin !== "{FQDN OF XDMOD INSTANCE WITH PROTOCOL AND PORT IF NEEDED}"){ - console.log('Received message from untrusted origin, discarding'); - return; - } - if(event.data.application == 'xdmod'){ - if(event.data.message == 'loginComplete'){ - console.log('XDMoD has logged in successfully'); +```html + + + Open XDMoD Integration + + + + + ```