SilverStripe\RealMe\Task\RealMeSetupTask
Class RealMeSetupTask
This class is intended to be run by a server administrator once the module is setup and configured via environment
variables, and YML fragments. The following tasks are done by this build task:
- Check to ensure that the task is being run from the cmdline (not in the browser, it's too sensitive)
- Check to ensure that the task hasn't already been run, and if it has, fail unless `force=1` is passed to the script
- Validate all required values have been added in the appropriate place, and provide appropriate errors if not
- Output metadata XML that must be submitted to RealMe in order to integrate with ITE and Production environments
Synopsis
class RealMeSetupTask
extends BuildTask
{
- // members
- private static string $segment = 'RealMeSetupTask';
- private static array $dependencies = ;
- protected string $title = "RealMe Setup Task";
- protected string $description = 'Validates a realme configuration & creates the resources needed to integrate with realme';
- private RealMeService $service;
- private array $errors = ;
- // methods
- public void run()
- public $this setService()
- private void validateInputs()
- private void outputMetadataXmlContent()
- private string replaceTemplateContents()
- private string getConfigurationTemplateDir()
- private void message()
- private bool isReadable()
- private void validateEntityID()
- private void validateAuthNContext()
- private void validateRealMeEnvironments()
- private void validateDirectoryStructure()
- private void validateMetadata()
- private void validateCertificates()
Hierarchy
Extends
- SilverStripe\Dev\BuildTask
Members
private
- $dependencies
- $errors
—
array
A list of validation errors found while validating the realme configuration. - $segment
- $service — SilverStripe\RealMe\RealMeService
protected
- $description
- $title
Methods
private
- getConfigurationTemplateDir()
- isReadable() — Thin wrapper around is_readable(), used mainly so we can test this class completely
- message() — Output a message to the console
- outputMetadataXmlContent() — Outputs metadata template XML to console, so it can be sent to RealMe Operations team
- replaceTemplateContents() — Replace content in a template file with an array of replacements
- validateAuthNContext() — Ensure we have an authncontext (how secure auth we require for each environment)
- validateCertificates() — Ensures the certificates are readable and that the service can sign and unencrypt using them
- validateDirectoryStructure() — Ensures that the directory structure is correct and the necessary directories are writable.
- validateEntityID() — The entity ID will pass validation, but raise an exception if the format of the service name and privacy realm are in the incorrect format.
- validateInputs() — Validate all inputs to this setup script. Ensures that all required values are available, where-ever they need to be loaded from (environment variables, Config API, or directly passed to this script via the cmd-line)
- validateMetadata() — Ensures that the required metadata is filled out correctly in the realme configuration.
- validateRealMeEnvironments() — Ensure's the environment we're building the setup for exists.
public
- run() — Run this setup task. See class phpdoc for the full description of what this does
- setService()