public function setFrameAncestorsHeader()
    {
        /** @var SettingsStorage $settingsStorage */
        $settingsStorage = $this->getServiceLocator()->get(SettingsStorage::SERVICE_ID);
        $whitelistedSources = $settingsStorage->get(CspHeaderSettingsInterface::CSP_HEADER_SETTING);

        if ($whitelistedSources === null) {
            $whitelistedSources = ["'none'"];
        }

        // Wrap directives in quotes
        if (in_array($whitelistedSources, ['self', 'none'])) {
            $whitelistedSources = ["'" . $whitelistedSources . "'"];
        }

        if ($whitelistedSources === 'list') {
            $whitelistedSources = json_decode($settingsStorage->get(CspHeaderSettingsInterface::CSP_HEADER_LIST), true);
        }

        if (!is_array($whitelistedSources)) {
            $whitelistedSources = [$whitelistedSources];
        }

        header(sprintf(
            'Content-Security-Policy: frame-ancestors %s',
            implode(' ', $whitelistedSources)
        ));
    }
public function setFrameAncestorsHeader()
    {
        /** @var SettingsStorage $settingsStorage */
        $settingsStorage = $this->getServiceLocator()->get(SettingsStorage::SERVICE_ID);
        $whitelistedSources = $settingsStorage->get(CspHeaderSettingsInterface::CSP_HEADER_SETTING);

        if ($whitelistedSources === null) {
            $whitelistedSources = ["'none'"];
        }

        // Wrap directives in quotes
        if (in_array($whitelistedSources, ['self', 'none'])) {
            $whitelistedSources = ["'" . $whitelistedSources . "'"];
        }

        if ($whitelistedSources === 'list') {
            $whitelistedSources = json_decode($settingsStorage->get(CspHeaderSettingsInterface::CSP_HEADER_LIST), true);
        }

        if (!is_array($whitelistedSources)) {
            $whitelistedSources = [$whitelistedSources];
        }

        header(sprintf(
            'Content-Security-Policy: frame-ancestors %s',
            implode(' ', $whitelistedSources)
        ));
    }
public function setFrameAncestorsHeader ( ) { /** @var SettingsStorage $settingsStorage */ $ settingsStorage = $ this -> getServiceLocator ( ) -> get ( SettingsStorage :: SERVICE_ID ) ; $ whitelistedSources = $ settingsStorage -> get ( CspHeaderSettingsInterface :: CSP_HEADER_SETTING ) ; if ( $ whitelistedSources === null ) { $ whitelistedSources = [ "'none'" ] ; } // Wrap directives in quotes if ( in_array ( $ whitelistedSources , [ 'self' , 'none' ] ) ) { $ whitelistedSources = [ "'" . $ whitelistedSources . "'" ] ; } if ( $ whitelistedSources === 'list' ) { $ whitelistedSources = json_decode ( $ settingsStorage -> get ( CspHeaderSettingsInterface :: CSP_HEADER_LIST ) , true ) ; } if ( ! is_array ( $ whitelistedSources ) ) { $ whitelistedSources = [ $ whitelistedSources ] ; } header ( sprintf ( 'Content-Security-Policy: frame-ancestors %s' , implode ( ' ' , $ whitelistedSources ) ) ) ; }
Set the header that defines which sources are allowed to embed the pages.

@return void
Set the header that defines which sources are allowed to embed the pages .