Skip to content

Commit

Permalink
Merge pull request #27 from silverstripe/pulls/reconfig-docs
Browse files Browse the repository at this point in the history
Add note on re-configuring RealMe module
  • Loading branch information
robbieaverill authored Jul 18, 2018
2 parents e781c71 + c5adfff commit a207c2f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/en/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,43 @@ You should now be able to proceed to testing the standard login form, or [using
- Complete an integration to MTS and ITE.
- Follow the steps as for the ITE environment above, but creating an integration request for production rather than ITE.

## More complex environments
If you are working with multiple website environments (e.g. multiple test sites or similar), you will encounter issues
using the basic configuration system above, because you will want multiple different websites to point to different RealMe
integrations (e.g. 'test1' website points to MTS, while 'test2' and 'staging' websites both point to ITE). To do this,
each website installation needs a separate RealMe integration (that is, a different SP Entity ID). Once these are
configured with RealMe, you can switch them out by modifying configuration. For now (until a solution to #26 is built),
the best solution is to use `RealMeService::config()->set()` for SS4. **Note:** This can cause a significant performance impact in SilverStripe 4, as by default YML configuration is immutable, and this overrides this which is not ideal. Use this only if it's really necessary, and ensure that the majority of your environments are still configured via YML as normal.

In your app/\_config.php:

```php
use \SilverStripe\RealMe\RealMeService
$changed = false;
$entityIds = RealMeService::config()->get('sp_entity_ids');
$domains = RealMeService::config()->get('metadata_assertion_service_domains');
// Update the configured entity IDs and return domains based on however you know what site you're on
if (getenv('SITE_ENVIRONMENT') == 'test2')) {
$entityIds['ite'] = 'https://test2-domain.example.com/privacy-realm/service-name';
$domains['ite'] = 'https://test2-domain.example.com';
$changed = true;
} elseif(getenv('SITE_ENVIRONMENT') == 'staging')) {
$entityIds['ite'] = 'https://staging-domain.example.com/privacy-realm/service-name';
$domains['ite'] = 'https://staging-domain.example.com';
$changed = true;
}
// Only mutate config if it's really necessary
if ($changed) {
RealMeService::config()->set('sp_entity_ids', $entityIds);
RealMeService::config()->set('metadata_assertion_service_domains', $domains);
}
```

This will allow you, if necessary, to re-configure the module in real-time based on the website environment. Note that you will still need to deploy the correct private/public keypairs to the correct servers etc.

## Syncing Realme with SilverStripe members
After logging in the module can sync the attributes returned from RealMe (depending on your assertion type) and sync the
details with the appropriate members.
Expand Down

0 comments on commit a207c2f

Please sign in to comment.